Island: Fix logic in needs_registration under auth service

This commit is contained in:
Ilija Lazoroski 2021-11-18 18:22:37 +01:00
parent b239b76063
commit 3994730f78
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ class AuthenticationService:
@classmethod
def needs_registration(cls) -> bool:
return cls.user_datastore.has_registered_users()
return not cls.user_datastore.has_registered_users()
@classmethod
def register_new_user(cls, username: str, password: str):

View File

@ -78,7 +78,7 @@ def test_needs_registration__true(tmp_path):
a_s = AuthenticationService()
a_s.initialize(tmp_path, mock_user_datastore)
assert a_s.needs_registration()
assert not a_s.needs_registration()
def test_needs_registration__false(tmp_path):
@ -87,7 +87,7 @@ def test_needs_registration__false(tmp_path):
a_s = AuthenticationService()
a_s.initialize(tmp_path, mock_user_datastore)
assert not a_s.needs_registration()
assert a_s.needs_registration()
@pytest.mark.parametrize("error", [InvalidRegistrationCredentialsError, AlreadyRegisteredError])