From 8dabd17819432fc90d8f3027f265edfe1c0c648b 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 | 23 ++++++ .../wizards/res_config_settings_views.xml | 82 +++++++++---------- 4 files changed, 66 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..9f76503656 --- /dev/null +++ b/website_cookiebot/tests/test_website_cookiebot.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.tests.common import TransactionCase +from odoo.tests import mock + +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) 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 - -
-
- + + + +