From f85126164c0dc5a6e9aaf819b880fa304416aaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominic=20Le=CC=81tourneau?= Date: Mon, 7 Oct 2024 10:02:50 -0400 Subject: [PATCH] Refs #253, fix tests. --- .../modules/FlaskModule/API/user/test_UserLogin.py | 8 ++++---- .../FlaskModule/API/user/test_UserLoginSetup2FA.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/teraserver/python/tests/modules/FlaskModule/API/user/test_UserLogin.py b/teraserver/python/tests/modules/FlaskModule/API/user/test_UserLogin.py index 04c736f2..76fb490b 100644 --- a/teraserver/python/tests/modules/FlaskModule/API/user/test_UserLogin.py +++ b/teraserver/python/tests/modules/FlaskModule/API/user/test_UserLogin.py @@ -9,8 +9,8 @@ def setUp(self): super().setUp() # Create users with 2fa enabled with self._flask_app.app_context(): - self.user1: dict = self._create_2fa_enabled_user('test_user_2fa_1', 'password', set_secret=True) - self.user2: dict = self._create_2fa_enabled_user('test_user_2fa_2', 'password', set_secret=False) + self.user1: dict = self._create_2fa_enabled_user('test_user_2fa_1', 'Password12345!', set_secret=True) + self.user2: dict = self._create_2fa_enabled_user('test_user_2fa_2', 'Password12345!', set_secret=False) def tearDown(self): # Delete users with 2fa enabled @@ -102,7 +102,7 @@ def test_get_endpoint_login_user1_2fa_already_setup(self): with self._flask_app.app_context(): # Login should redirect to 2fa verification - response = self._get_with_user_http_auth(self.test_client, 'test_user_2fa_1', 'password') + response = self._get_with_user_http_auth(self.test_client, 'test_user_2fa_1', 'Password12345!') self.assertEqual(200, response.status_code) self.assertTrue('redirect_url' in response.json) self.assertFalse('login_setup_2fa' in response.json['redirect_url']) @@ -117,7 +117,7 @@ def test_get_endpoint_login_user2_2fa_not_setup(self): with self._flask_app.app_context(): # Login should redirect to 2fa verification - response = self._get_with_user_http_auth(self.test_client, 'test_user_2fa_2', 'password') + response = self._get_with_user_http_auth(self.test_client, 'test_user_2fa_2', 'Password12345!') self.assertEqual(200, response.status_code) self.assertTrue('redirect_url' in response.json) self.assertTrue('login_setup_2fa' in response.json['redirect_url']) diff --git a/teraserver/python/tests/modules/FlaskModule/API/user/test_UserLoginSetup2FA.py b/teraserver/python/tests/modules/FlaskModule/API/user/test_UserLoginSetup2FA.py index 793551c0..f9ec2c9a 100644 --- a/teraserver/python/tests/modules/FlaskModule/API/user/test_UserLoginSetup2FA.py +++ b/teraserver/python/tests/modules/FlaskModule/API/user/test_UserLoginSetup2FA.py @@ -10,8 +10,8 @@ def setUp(self): super().setUp() # Create users with 2fa enabled with self._flask_app.app_context(): - self.user1: dict = self._create_2fa_enabled_user('test_user_2fa_1', 'password', set_secret=True) - self.user2: dict = self._create_2fa_enabled_user('test_user_2fa_2', 'password', set_secret=False) + self.user1: dict = self._create_2fa_enabled_user('test_user_2fa_1', 'Password12345!', set_secret=True) + self.user2: dict = self._create_2fa_enabled_user('test_user_2fa_2', 'Password12345!', set_secret=False) def tearDown(self): # Delete users with 2fa enabled @@ -79,7 +79,7 @@ def test_get_endpoint_login_user1_2fa_already_setup(self): with self._flask_app.app_context(): # Fisrt login to create session - response = self._login_user('test_user_2fa_1', 'password') + response = self._login_user('test_user_2fa_1', 'Password12345!') self.assertEqual(200, response.status_code) self.assertTrue('redirect_url' in response.json) self.assertFalse('login_setup_2fa' in response.json['redirect_url']) @@ -92,7 +92,7 @@ def test_get_endpoint_login_user2_http_auth_should_work_but_and_modify_user_afte with self._flask_app.app_context(): # First login to create session - response = self._login_user('test_user_2fa_2', 'password') + response = self._login_user('test_user_2fa_2', 'Password12345!') self.assertEqual(200, response.status_code) self.assertTrue('redirect_url' in response.json) self.assertTrue('login_setup_2fa' in response.json['redirect_url']) @@ -133,7 +133,7 @@ def test_get_endpoint_login_user2_http_auth_should_fail_after_post_with_wrong_co with self._flask_app.app_context(): # First login to create session - response = self._login_user('test_user_2fa_2', 'password') + response = self._login_user('test_user_2fa_2', 'Password12345!') self.assertEqual(200, response.status_code) self.assertTrue('redirect_url' in response.json) self.assertTrue('login_setup_2fa' in response.json['redirect_url']) @@ -160,7 +160,7 @@ def test_get_endpoint_login_user2_http_auth_should_fail_after_post_with_wrong_se with self._flask_app.app_context(): # First login to create session - response = self._login_user('test_user_2fa_2', 'password') + response = self._login_user('test_user_2fa_2', 'Password12345!') self.assertEqual(200, response.status_code) self.assertTrue('redirect_url' in response.json) self.assertTrue('login_setup_2fa' in response.json['redirect_url'])