diff --git a/monkey/monkey_island/cc/services/__init__.py b/monkey/monkey_island/cc/services/__init__.py index bfecc7588..4adb18eb2 100644 --- a/monkey/monkey_island/cc/services/__init__.py +++ b/monkey/monkey_island/cc/services/__init__.py @@ -1,5 +1,5 @@ from .authentication.authentication_service import AuthenticationService -from .authentication.json_file_user_datastore import JsonFileUserDatastore +from .authentication.json_file_user_datastore import JSONFileUserRepository from .aws import AWSService from .island_mode_service import IslandModeService diff --git a/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py b/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py index 8ac3e35d7..87ef873e1 100644 --- a/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py +++ b/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py @@ -14,7 +14,7 @@ from .user_creds import UserCreds CREDENTIALS_FILE = "credentials.json" -class JsonFileUserDatastore(IUserRepository): +class JSONFileUserRepository(IUserRepository): def __init__(self, data_dir: Path): self._credentials = None self._credentials_file = data_dir / CREDENTIALS_FILE diff --git a/monkey/monkey_island/cc/services/initialize.py b/monkey/monkey_island/cc/services/initialize.py index 02068c382..d5b197059 100644 --- a/monkey/monkey_island/cc/services/initialize.py +++ b/monkey/monkey_island/cc/services/initialize.py @@ -40,7 +40,7 @@ from monkey_island.cc.services.telemetry.processing.processing import ( ) from monkey_island.cc.setup.mongo.mongo_setup import MONGO_URL -from . import AuthenticationService, JsonFileUserDatastore +from . import AuthenticationService, JSONFileUserRepository from .authentication.i_user_datastore import IUserRepository from .reporting.report import ReportService @@ -95,7 +95,7 @@ def _register_repositories(container: DIContainer, data_dir: Path): container.register_instance( ICredentialsRepository, container.resolve(MongoCredentialsRepository) ) - container.register_instance(IUserRepository, container.resolve(JsonFileUserDatastore)) + container.register_instance(IUserRepository, container.resolve(JSONFileUserRepository)) def _decorate_file_repository(file_repository: IFileRepository) -> IFileRepository: diff --git a/monkey/tests/unit_tests/monkey_island/cc/services/test_json_file_user_datastore.py b/monkey/tests/unit_tests/monkey_island/cc/services/test_json_file_user_datastore.py index 4aae5cd3d..3681ee7fc 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/test_json_file_user_datastore.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/test_json_file_user_datastore.py @@ -12,7 +12,7 @@ from common.utils.exceptions import ( from monkey_island.cc.server_utils.file_utils import is_windows_os from monkey_island.cc.services.authentication.json_file_user_datastore import ( CREDENTIALS_FILE, - JsonFileUserDatastore, + JSONFileUserRepository, ) from monkey_island.cc.services.authentication.user_creds import UserCreds @@ -22,12 +22,12 @@ PASSWORD_HASH = "DEADBEEF" @pytest.fixture def empty_datastore(tmp_path): - return JsonFileUserDatastore(tmp_path) + return JSONFileUserRepository(tmp_path) @pytest.fixture def populated_datastore(data_for_tests_dir): - return JsonFileUserDatastore(data_for_tests_dir) + return JSONFileUserRepository(data_for_tests_dir) @pytest.fixture @@ -91,10 +91,10 @@ def test_add_user__already_registered(populated_datastore): def test_get_user_credentials_from_file(tmp_path): - empty_datastore = JsonFileUserDatastore(tmp_path) + empty_datastore = JSONFileUserRepository(tmp_path) empty_datastore.add_user(UserCreds(USERNAME, PASSWORD_HASH)) - populated_datastore = JsonFileUserDatastore(tmp_path) + populated_datastore = JSONFileUserRepository(tmp_path) stored_user = populated_datastore.get_user_credentials(USERNAME) assert stored_user.username == USERNAME