From 205b42b4549ecc54cc325c5c4f18996a64334cb2 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 7 Dec 2020 20:43:23 +0100 Subject: [PATCH] [FIX] web_company_color: Resilient tests We need to disable the company unlinking test, as if not, when tested in integrated environments, it fails as there are records linked to the company, like the warehouse when `stock` module is installed. --- web_company_color/__manifest__.py | 4 ++-- web_company_color/tests/test_res_company.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/web_company_color/__manifest__.py b/web_company_color/__manifest__.py index 219ab9178..29c10b1d4 100644 --- a/web_company_color/__manifest__.py +++ b/web_company_color/__manifest__.py @@ -5,8 +5,8 @@ { "name": "Web Company Color", "category": "web", - "version": "13.0.1.0.0", - "author": "Alexandre Díaz, " "Odoo Community Association (OCA)", + "version": "13.0.1.0.1", + "author": "Alexandre Díaz, Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", "depends": ["web", "base_sparse_field"], "data": ["view/assets.xml", "view/res_company.xml"], diff --git a/web_company_color/tests/test_res_company.py b/web_company_color/tests/test_res_company.py index 5b27c589e..8234b6f44 100644 --- a/web_company_color/tests/test_res_company.py +++ b/web_company_color/tests/test_res_company.py @@ -11,7 +11,7 @@ class TestResCompany(common.TransactionCase): + "EQVR42mNk+M/wHwAEBgIApD5fRAAAAABJRU5ErkJggg==" ) - def test_scss_attachment(self): + def _test_scss_attachment(self): num_scss = self.env["ir.attachment"].search_count( [("url", "ilike", "%s%%" % URL_BASE)] ) @@ -23,13 +23,15 @@ class TestResCompany(common.TransactionCase): self.assertEqual( company_id.color_navbar_bg, False, "Invalid Navbar Background Color" ) - self.test_scss_attachment() + self._test_scss_attachment() company_id.sudo().write({"logo": self.IMG_GREEN}) self.assertEqual( company_id.color_navbar_bg, "#00ff00", "Invalid Navbar Background Color" ) - company_id.sudo().unlink() - self.test_scss_attachment() + # TODO: We can't remove companies if they have attached data, like + # warehouse when we have stock module installed + # company_id.sudo().unlink() + # self._test_scss_attachment() def test_change_logo(self): company_id = self.env["res.company"].search([], limit=1)