diff --git a/monkey/tests/monkey_island/cc/environment/test_environment.py b/monkey/tests/monkey_island/cc/environment/test_environment.py index 8d4c4147ed6..6b648ddeed8 100644 --- a/monkey/tests/monkey_island/cc/environment/test_environment.py +++ b/monkey/tests/monkey_island/cc/environment/test_environment.py @@ -20,7 +20,8 @@ STANDARD_WITH_CREDENTIALS = None STANDARD_ENV = None -EMPTY_CREDS = UserCreds("", "") +EMPTY_USER_CREDENTIALS = UserCreds("", "") +FULL_USER_CREDENTIALS = UserCreds(username="test", password_hash="1231234") # This fixture is a dirty hack that can be removed once these tests are converted from @@ -69,7 +70,7 @@ def get_server_config_file_path_test_version(): class TestEnvironment(TestCase): class EnvironmentCredentialsNotRequired(Environment): def __init__(self): - config = StubEnvironmentConfig("test", "test", EMPTY_CREDS) + config = StubEnvironmentConfig("test", "test", EMPTY_USER_CREDENTIALS) super().__init__(config) _credentials_required = False @@ -79,7 +80,7 @@ def get_auth_users(self): class EnvironmentCredentialsRequired(Environment): def __init__(self): - config = StubEnvironmentConfig("test", "test", EMPTY_CREDS) + config = StubEnvironmentConfig("test", "test", EMPTY_USER_CREDENTIALS) super().__init__(config) _credentials_required = True @@ -100,7 +101,7 @@ def get_auth_users(self): @patch.object(target=EnvironmentConfig, attribute="save_to_file", new=MagicMock()) def test_try_add_user(self): env = TestEnvironment.EnvironmentCredentialsRequired() - credentials = UserCreds(username="test", password_hash="1231234") + credentials = FULL_USER_CREDENTIALS env.try_add_user(credentials) credentials = UserCreds(username="test", password_hash="") @@ -108,7 +109,7 @@ def test_try_add_user(self): env.try_add_user(credentials) env = TestEnvironment.EnvironmentCredentialsNotRequired() - credentials = UserCreds(username="test", password_hash="1231234") + credentials = FULL_USER_CREDENTIALS with self.assertRaises(RegistrationNotNeededError): env.try_add_user(credentials)