forked from p15670423/monkey
Tests: Clarify needs_registration() tests for AuthenticationService
This commit is contained in:
parent
3994730f78
commit
f08ac42ac9
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue