[ADD] web_favicon: test case for _get_favicon handling multiple companies in cids cookie

pull/3013/head
Franco Leyes 2025-01-08 08:18:41 -03:00
parent 351f02c0e3
commit 5352564f26
1 changed files with 26 additions and 0 deletions

View File

@ -72,3 +72,29 @@ class TestWebFavicon(TransactionCase):
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.",
)