Skip to content

Commit

Permalink
fix: apply no_user_creation for AccessDenied
Browse files Browse the repository at this point in the history
  • Loading branch information
dnplkndll committed Jan 17, 2025
1 parent b14b991 commit 533dd29
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions auth_oauth_multi_token/tests/test_multi_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 533dd29

Please sign in to comment.