Skip to content

Commit

Permalink
[ADD] web_favicon: test case for _get_favicon handling multiple compa…
Browse files Browse the repository at this point in the history
…nies in cids cookie
  • Loading branch information
lef-adhoc committed Jan 8, 2025
1 parent 351f02c commit a5ce945
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions web_favicon/tests/test_web_favicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,21 @@ def test_03_website_favicon(self):
expected_favicon_url,
"The favicon URL should match the expected value.",
)

def test_04_favicon_multiple_companies(self):
"""Test _get_favicon with multiple companies in cids cookie."""
Company = self.env["res.company"]

company_1 = Company.create({"name": "Company 1", "favicon": Company._get_default_favicon()})
company_2 = Company.create({"name": "Company 2", "favicon": Company._get_default_favicon()})

with MockRequest(self.env) as mock_request:
mock_request.httprequest.cookies = {"cids": f"{company_1.id}-{company_2.id}"}
favicon_url = Company._get_favicon()

self.assertTrue(favicon_url, "Favicon URL should be generated for multiple companies.")
self.assertIn(
str(company_1.id),
favicon_url,
"Favicon URL should correspond to the first company in the cids cookie.",
)

0 comments on commit a5ce945

Please sign in to comment.