Skip to content
Snippets Groups Projects
test_with_lang.py 1.38 KiB
Newer Older
##############################################################################
#
#    Context Methods, for Odoo
Axel Prel's avatar
Axel Prel committed
#    Copyright © 2022, 2023, 2024 XCG Consulting <https://xcg-consulting.fr>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import tests


class Test(tests.TransactionCase):
    """Tests for the :py:meth:odoo.models.Model.with_lang method."""

    def test_with_lang(self):
        """Test :py:meth:odoo.addons.Model.with_lang added by this module"""
        # Assert that no lang is in context
        self.assertFalse("lang" in self.env.context)
        # Assert that a lang is added
        self.assertTrue(self.env["res.users"].with_lang().env.context["lang"])