Skip to content

Commit

Permalink
Refs #253, fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
doumdi committed Oct 7, 2024
1 parent 27defa9 commit f851261
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'])
Expand All @@ -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'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'])
Expand All @@ -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'])
Expand Down Expand Up @@ -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'])
Expand All @@ -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'])
Expand Down

0 comments on commit f851261

Please sign in to comment.