Skip to content

Commit

Permalink
[18.0][UPD] Update Test cases test_auth_admin_passkey.py
Browse files Browse the repository at this point in the history
  • Loading branch information
moncefarajdal authored Oct 16, 2024
1 parent b9bc030 commit 41a1189
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions auth_admin_passkey/tests/test_auth_admin_passkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,35 @@ def setUpClass(cls):
cls.user = user.with_user(user)

def test_01_normal_login_succeed(self):
self.user._check_credentials(self.user_password, {"interactive": True})
self.user._check_credentials({"password": self.user_password}, {"interactive": True})

def test_02_normal_login_fail(self):
with self.assertRaises(exceptions.AccessDenied):
self.user._check_credentials(self.bad_password, {"interactive": True})

self.user._check_credentials({"password": self.bad_password}, {"interactive": True})
def test_03_normal_login_passkey_fail(self):
# This should failed, because feature is disabled
# This should fail, because feature is disabled
config["auth_admin_passkey_password"] = False
config["auth_admin_passkey_password_sha512_encrypted"] = False
with self.assertRaises(exceptions.AccessDenied):
self.user._check_credentials(self.sysadmin_passkey, {"interactive": True})

self.user._check_credentials({"password": self.sysadmin_passkey}, {"interactive": True})
def test_04_normal_login_passkey_succeed(self):
# This should succeed, because feature is enabled
config["auth_admin_passkey_password"] = self.sysadmin_passkey
config["auth_admin_passkey_password_sha512_encrypted"] = False
self.user._check_credentials(self.sysadmin_passkey, {"interactive": True})

self.user._check_credentials({"password": self.sysadmin_passkey}, {"interactive": True})
def test_05_passkey_login_passkey_succeed(self):
"""[Bug #1319391]
Test the correct behaviour of login with 'bad_login' / 'admin'"""
with self.assertRaises(exceptions.AccessDenied):
self.ResUsers.authenticate(
self.db, self.bad_login, self.sysadmin_passkey, {}
self.db, self.bad_login, {"password": self.sysadmin_passkey}, {}
)

def test_06_normal_login_passkey_succeed_encrypted_password(self):
# This should succeed, because feature is enabled
config["auth_admin_passkey_password"] = self.sysadmin_passkey_encrypted
config["auth_admin_passkey_password_sha512_encrypted"] = True
self.user._check_credentials(self.sysadmin_passkey, {"interactive": True})
self.user._check_credentials({"password": self.sysadmin_passkey}, {"interactive": True})

0 comments on commit 41a1189

Please sign in to comment.