From 3792c89ecbbea54a90ca4e04fcf220fc48e358c5 Mon Sep 17 00:00:00 2001 From: flan Date: Sun, 29 Oct 2017 19:29:46 +0100 Subject: [PATCH] Fix authentication c7d7ff3e858415ec12785579882a4c7586cbfce4 broke it --- ankisyncd/users.py | 2 +- tests/test_users.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ankisyncd/users.py b/ankisyncd/users.py index 49c4d80..0f07509 100644 --- a/ankisyncd/users.py +++ b/ankisyncd/users.py @@ -120,7 +120,7 @@ class SqliteUserManager(SimpleUserManager): logging.info("Changed password for user {}.".format(username)) - def authenticate_user(self, username, password): + def authenticate(self, username, password): """Returns True if this username is allowed to connect with this password. False otherwise.""" conn = sqlite.connect(self.auth_db_path) diff --git a/tests/test_users.py b/tests/test_users.py index 6994692..59fdfbe 100644 --- a/tests/test_users.py +++ b/tests/test_users.py @@ -146,15 +146,15 @@ class SqliteUserManagerTest(unittest.TestCase): self.user_manager._create_user_dir(username) self.assertTrue(os.path.isdir(expected_dir_path)) - def test_authenticate_user(self): + def test_authenticate(self): username = "my_username" password = "my_password" self.user_manager.create_auth_db() self.user_manager.add_user(username, password) - self.assertTrue(self.user_manager.authenticate_user(username, - password)) + self.assertTrue(self.user_manager.authenticate(username, + password)) def test_set_password_for_user(self): username = "my_username" @@ -165,8 +165,8 @@ class SqliteUserManagerTest(unittest.TestCase): self.user_manager.add_user(username, password) self.user_manager.set_password_for_user(username, new_password) - self.assertFalse(self.user_manager.authenticate_user(username, - password)) - self.assertTrue(self.user_manager.authenticate_user(username, - new_password)) + self.assertFalse(self.user_manager.authenticate(username, + password)) + self.assertTrue(self.user_manager.authenticate(username, + new_password))