From c1a9ad1e6fc59f81a47a9a58429c08a90c2343a5 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 12 Jul 2022 09:00:09 -0400 Subject: [PATCH] Island: Move JSONFileUserRepository to the repository package --- monkey/monkey_island/cc/repository/__init__.py | 1 + .../json_file_user_repository.py} | 0 monkey/monkey_island/cc/services/__init__.py | 1 - monkey/monkey_island/cc/services/initialize.py | 3 ++- .../test_json_file_user_repository.py} | 4 ++-- 5 files changed, 5 insertions(+), 4 deletions(-) rename monkey/monkey_island/cc/{services/authentication/json_file_user_datastore.py => repository/json_file_user_repository.py} (100%) rename monkey/tests/unit_tests/monkey_island/cc/{services/test_json_file_user_datastore.py => repository/test_json_file_user_repository.py} (97%) diff --git a/monkey/monkey_island/cc/repository/__init__.py b/monkey/monkey_island/cc/repository/__init__.py index 232a0b165..075317b43 100644 --- a/monkey/monkey_island/cc/repository/__init__.py +++ b/monkey/monkey_island/cc/repository/__init__.py @@ -17,4 +17,5 @@ from .file_repository_logging_decorator import FileRepositoryLoggingDecorator from .agent_binary_repository import AgentBinaryRepository from .file_agent_configuration_repository import FileAgentConfigurationRepository from .file_simulation_repository import FileSimulationRepository +from .json_file_user_repository import JSONFileUserRepository from .mongo_credentials_repository import MongoCredentialsRepository diff --git a/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py b/monkey/monkey_island/cc/repository/json_file_user_repository.py similarity index 100% rename from monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py rename to monkey/monkey_island/cc/repository/json_file_user_repository.py diff --git a/monkey/monkey_island/cc/services/__init__.py b/monkey/monkey_island/cc/services/__init__.py index 4adb18eb2..91bea103c 100644 --- a/monkey/monkey_island/cc/services/__init__.py +++ b/monkey/monkey_island/cc/services/__init__.py @@ -1,5 +1,4 @@ from .authentication.authentication_service import AuthenticationService -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/initialize.py b/monkey/monkey_island/cc/services/initialize.py index 9474ea3bd..4f326f58d 100644 --- a/monkey/monkey_island/cc/services/initialize.py +++ b/monkey/monkey_island/cc/services/initialize.py @@ -25,6 +25,7 @@ from monkey_island.cc.repository import ( IFileRepository, ISimulationRepository, IUserRepository, + JSONFileUserRepository, LocalStorageFileRepository, MongoCredentialsRepository, RetrievalError, @@ -41,7 +42,7 @@ from monkey_island.cc.services.telemetry.processing.processing import ( ) from monkey_island.cc.setup.mongo.mongo_setup import MONGO_URL -from . import AuthenticationService, JSONFileUserRepository +from . import AuthenticationService from .reporting.report import ReportService logger = logging.getLogger(__name__) 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/repository/test_json_file_user_repository.py similarity index 97% rename from monkey/tests/unit_tests/monkey_island/cc/services/test_json_file_user_datastore.py rename to monkey/tests/unit_tests/monkey_island/cc/repository/test_json_file_user_repository.py index 98119d7e5..050788c26 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/test_json_file_user_datastore.py +++ b/monkey/tests/unit_tests/monkey_island/cc/repository/test_json_file_user_repository.py @@ -10,11 +10,11 @@ from common.utils.exceptions import ( UnknownUserError, ) from monkey_island.cc.models import UserCredentials -from monkey_island.cc.server_utils.file_utils import is_windows_os -from monkey_island.cc.services.authentication.json_file_user_datastore import ( +from monkey_island.cc.repository.json_file_user_repository import ( CREDENTIALS_FILE, JSONFileUserRepository, ) +from monkey_island.cc.server_utils.file_utils import is_windows_os USERNAME = "test" PASSWORD_HASH = "DEADBEEF"