diff --git a/monkey/tests/unit_tests/monkey_island/cc/services/authentication/test_authentication_service.py b/monkey/tests/unit_tests/monkey_island/cc/services/authentication/test_authentication_service.py index 3c61594ad..62f73fa02 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/authentication/test_authentication_service.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/authentication/test_authentication_service.py @@ -73,16 +73,8 @@ def patch_datastore_utils( def test_needs_registration__true(tmp_path): - mock_user_datastore = MockUserDatastore(lambda: True, None, None) - - a_s = AuthenticationService() - a_s.initialize(tmp_path, mock_user_datastore) - - assert not a_s.needs_registration() - - -def test_needs_registration__false(tmp_path): - mock_user_datastore = MockUserDatastore(lambda: False, None, None) + has_registered_users = False + mock_user_datastore = MockUserDatastore(lambda: has_registered_users, None, None) a_s = AuthenticationService() a_s.initialize(tmp_path, mock_user_datastore) @@ -90,6 +82,16 @@ def test_needs_registration__false(tmp_path): assert a_s.needs_registration() +def test_needs_registration__false(tmp_path): + has_registered_users = True + mock_user_datastore = MockUserDatastore(lambda: has_registered_users, None, None) + + a_s = AuthenticationService() + a_s.initialize(tmp_path, mock_user_datastore) + + assert not a_s.needs_registration() + + @pytest.mark.parametrize("error", [InvalidRegistrationCredentialsError, AlreadyRegisteredError]) def test_register_new_user__fails( tmp_path, mock_reset_datastore_encryptor, mock_reset_database, error