From af9fff51839801b659de7d1b1388ebb9e9dda4dc Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Mon, 26 Jun 2023 11:12:07 +0200 Subject: [PATCH] [IMP] extendable_fastapi: Add class to ease tests with fastapi and extendable --- extendable_fastapi/tests/__init__.py | 0 extendable_fastapi/tests/common.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 extendable_fastapi/tests/__init__.py create mode 100644 extendable_fastapi/tests/common.py diff --git a/extendable_fastapi/tests/__init__.py b/extendable_fastapi/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/extendable_fastapi/tests/common.py b/extendable_fastapi/tests/common.py new file mode 100644 index 000000000..ddefb65e4 --- /dev/null +++ b/extendable_fastapi/tests/common.py @@ -0,0 +1,21 @@ +# Copyright 2023 ACSONE SA/NV +# License LGPL-3.0 or later (http://www.gnu.org/licenses/LGPL). + +from odoo.addons.extendable.tests.common import ExtendableMixin +from odoo.addons.fastapi.tests.common import ( + FastAPITransactionCase as BaseFastAPITransactionCase, +) + + +class FastAPITransactionCase(BaseFastAPITransactionCase, ExtendableMixin): + """Base class for FastAPI tests using extendable classes.""" + + @classmethod + def setUpClass(cls) -> None: + super().setUpClass() + cls.init_extendable_registry() + + @classmethod + def tearDownClass(cls) -> None: + super().tearDownClass() + cls.reset_extendable_registry()