From 4fb96f72f73dea52012f46edf4a967270105c9f8 Mon Sep 17 00:00:00 2001 From: Adrian Resua Vidal Date: Thu, 20 Jun 2024 09:30:26 +0200 Subject: [PATCH] [MIG] website_cookiebot: Migration to 17.0 --- website_cookiebot/__manifest__.py | 2 +- website_cookiebot/tests/__init__.py | 3 + .../tests/test_website_cookiebot.py | 29 +++++++ .../wizards/res_config_settings_views.xml | 82 +++++++++---------- 4 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 website_cookiebot/tests/__init__.py create mode 100644 website_cookiebot/tests/test_website_cookiebot.py diff --git a/website_cookiebot/__manifest__.py b/website_cookiebot/__manifest__.py index a14c7a2474..37ee70dde1 100644 --- a/website_cookiebot/__manifest__.py +++ b/website_cookiebot/__manifest__.py @@ -5,7 +5,7 @@ "name": "Website Cookiebot", "summary": "Ask for cookies consent connecting with Cookiebot", "category": "Website", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "author": "Trey (www.trey.es), Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/website", "license": "AGPL-3", diff --git a/website_cookiebot/tests/__init__.py b/website_cookiebot/tests/__init__.py new file mode 100644 index 0000000000..3499c95804 --- /dev/null +++ b/website_cookiebot/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import test_website_cookiebot diff --git a/website_cookiebot/tests/test_website_cookiebot.py b/website_cookiebot/tests/test_website_cookiebot.py new file mode 100644 index 0000000000..95734c5257 --- /dev/null +++ b/website_cookiebot/tests/test_website_cookiebot.py @@ -0,0 +1,29 @@ +# © 2024 Solvos Consultoría Informática () +# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html + +from odoo.tests.common import TransactionCase + + +class TestWebsiteCookiebot(TransactionCase): + def test_conf_cookiebot_domain(self): + domain_group_id = "9a9999a9-aa99-9a99-999a-aa999999999a" + config = self.env["res.config.settings"].sudo().create({}) + config.write({"cookiebot_dgid": domain_group_id}) + self.assertTrue(config.cookiebot_enabled) + self.assertFalse(config.website_cookies_bar) + self.assertEqual(config.cookiebot_dgid, domain_group_id) + + def test_conf_website_cookies_bar(self): + config = self.env["res.config.settings"].sudo().create({}) + config.write({"website_cookies_bar": True}) + config._onchange_website_cookies_bar() + self.assertTrue(config.website_cookies_bar) + self.assertFalse(config.cookiebot_enabled) + self.assertFalse(config.cookiebot_dgid) + + def test_conf_cookies_enabled(self): + config = self.env["res.config.settings"].sudo().create({}) + config.write({"cookiebot_enabled": True}) + config._onchange_cookiebot_enabled() + self.assertFalse(config.website_cookies_bar) + self.assertTrue(config.cookiebot_enabled) diff --git a/website_cookiebot/wizards/res_config_settings_views.xml b/website_cookiebot/wizards/res_config_settings_views.xml index f30f8d45b7..5a20724ffe 100644 --- a/website_cookiebot/wizards/res_config_settings_views.xml +++ b/website_cookiebot/wizards/res_config_settings_views.xml @@ -6,53 +6,49 @@ res.config.settings - -
-
- + + + +