forked from p15670423/monkey
Island: Fix logic in needs_registration under auth service
This commit is contained in:
parent
b239b76063
commit
3994730f78
|
@ -25,7 +25,7 @@ class AuthenticationService:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def needs_registration(cls) -> bool:
|
def needs_registration(cls) -> bool:
|
||||||
return cls.user_datastore.has_registered_users()
|
return not cls.user_datastore.has_registered_users()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def register_new_user(cls, username: str, password: str):
|
def register_new_user(cls, username: str, password: str):
|
||||||
|
|
|
@ -78,7 +78,7 @@ def test_needs_registration__true(tmp_path):
|
||||||
a_s = AuthenticationService()
|
a_s = AuthenticationService()
|
||||||
a_s.initialize(tmp_path, mock_user_datastore)
|
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):
|
def test_needs_registration__false(tmp_path):
|
||||||
|
@ -87,7 +87,7 @@ def test_needs_registration__false(tmp_path):
|
||||||
a_s = AuthenticationService()
|
a_s = AuthenticationService()
|
||||||
a_s.initialize(tmp_path, mock_user_datastore)
|
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])
|
@pytest.mark.parametrize("error", [InvalidRegistrationCredentialsError, AlreadyRegisteredError])
|
||||||
|
|
Loading…
Reference in New Issue