diff --git a/auth_oauth_multi_token/tests/test_multi_token.py b/auth_oauth_multi_token/tests/test_multi_token.py index b70fdb4731..730e22a000 100644 --- a/auth_oauth_multi_token/tests/test_multi_token.py +++ b/auth_oauth_multi_token/tests/test_multi_token.py @@ -2,10 +2,13 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) import json +import logging -from odoo import exceptions +from odoo.exceptions import AccessDenied from odoo.tests.common import TransactionCase +_logger = logging.getLogger(__name__) + class TestMultiToken(TransactionCase): @classmethod @@ -38,14 +41,11 @@ def test_no_provider_no_access(self): "user_id": "oauth_uid_no_one", } params = self._fake_params() - try: - with self.assertRaises(exceptions.AccessDenied): - self.user_model._auth_oauth_signin( - self.provider_google.id, validation, params - ) - # In version 18.0 AccessDenied exception is raising ValueError exception - except ValueError as e: - self.assertEqual(str(e), "Unknown token version") + + with self.assertRaises(AccessDenied): + self.user_model.with_context( + **{"no_user_creation": True} + )._auth_oauth_signin(self.provider_google.id, validation, params) def _test_one_token(self): validation = {