From db74ea013dfe8513d13c72d150af12d19d7505e9 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 11 Jul 2022 14:51:20 -0400 Subject: [PATCH] Island: Remove unnecessary resources/credentials subpackage --- monkey/monkey_island/cc/app.py | 3 +-- monkey/monkey_island/cc/resources/__init__.py | 1 + .../cc/resources/credentials/__init__.py | 0 .../{credentials => }/propagation_credentials.py | 0 .../cc/resources/credentials/__init__.py | 0 .../cc/resources/credentials/conftest.py | 15 --------------- .../test_propagation_credentials.py | 2 +- 7 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 monkey/monkey_island/cc/resources/credentials/__init__.py rename monkey/monkey_island/cc/resources/{credentials => }/propagation_credentials.py (100%) delete mode 100644 monkey/tests/unit_tests/monkey_island/cc/resources/credentials/__init__.py delete mode 100644 monkey/tests/unit_tests/monkey_island/cc/resources/credentials/conftest.py rename monkey/tests/unit_tests/monkey_island/cc/resources/{credentials => }/test_propagation_credentials.py (97%) diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index 590d86f18..52b6bd30b 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -13,6 +13,7 @@ from monkey_island.cc.database import database, mongo from monkey_island.cc.resources import ( AgentBinaries, ClearSimulationData, + PropagationCredentials, RemoteRun, ResetAgentConfiguration, ) @@ -28,7 +29,6 @@ from monkey_island.cc.resources.blackbox.monkey_blackbox_endpoint import MonkeyB from monkey_island.cc.resources.blackbox.telemetry_blackbox_endpoint import ( TelemetryBlackboxEndpoint, ) -from monkey_island.cc.resources.credentials.propagation_credentials import PropagationCredentials from monkey_island.cc.resources.edge import Edge from monkey_island.cc.resources.exploitations.manual_exploitation import ManualExploitation from monkey_island.cc.resources.exploitations.monkey_exploitation import MonkeyExploitation @@ -185,7 +185,6 @@ def init_restful_endpoints(api: FlaskDIWrapper): api.add_resource(FileUpload) api.add_resource(PropagationCredentials) - api.add_resource(RemoteRun) api.add_resource(VersionUpdate) api.add_resource(StopAgentCheck) diff --git a/monkey/monkey_island/cc/resources/__init__.py b/monkey/monkey_island/cc/resources/__init__.py index 7f0385c32..bd0ed0d18 100644 --- a/monkey/monkey_island/cc/resources/__init__.py +++ b/monkey/monkey_island/cc/resources/__init__.py @@ -2,3 +2,4 @@ from .remote_run import RemoteRun from .agent_binaries import AgentBinaries from .clear_simulation_data import ClearSimulationData from .reset_agent_configuration import ResetAgentConfiguration +from .propagation_credentials import PropagationCredentials diff --git a/monkey/monkey_island/cc/resources/credentials/__init__.py b/monkey/monkey_island/cc/resources/credentials/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/monkey/monkey_island/cc/resources/credentials/propagation_credentials.py b/monkey/monkey_island/cc/resources/propagation_credentials.py similarity index 100% rename from monkey/monkey_island/cc/resources/credentials/propagation_credentials.py rename to monkey/monkey_island/cc/resources/propagation_credentials.py diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/credentials/__init__.py b/monkey/tests/unit_tests/monkey_island/cc/resources/credentials/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/credentials/conftest.py b/monkey/tests/unit_tests/monkey_island/cc/resources/credentials/conftest.py deleted file mode 100644 index ab1bee2af..000000000 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/credentials/conftest.py +++ /dev/null @@ -1,15 +0,0 @@ -import pytest -from tests.common import StubDIContainer -from tests.monkey_island import StubPropagationCredentialsRepository - -from monkey_island.cc.repository import ICredentialsRepository - - -@pytest.fixture -def flask_client(build_flask_client): - container = StubDIContainer() - - container.register(ICredentialsRepository, StubPropagationCredentialsRepository) - - with build_flask_client(container) as flask_client: - yield flask_client diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/credentials/test_propagation_credentials.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_propagation_credentials.py similarity index 97% rename from monkey/tests/unit_tests/monkey_island/cc/resources/credentials/test_propagation_credentials.py rename to monkey/tests/unit_tests/monkey_island/cc/resources/test_propagation_credentials.py index cf70edcfc..d34a45a25 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/credentials/test_propagation_credentials.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_propagation_credentials.py @@ -14,7 +14,7 @@ from tests.monkey_island import InMemoryCredentialsRepository from common.credentials import Credentials from monkey_island.cc.repository import ICredentialsRepository -from monkey_island.cc.resources.credentials.propagation_credentials import PropagationCredentials +from monkey_island.cc.resources import PropagationCredentials ALL_CREDENTIALS_URL = PropagationCredentials.urls[0] CONFIGURED_CREDENTIALS_URL = PropagationCredentials.urls[1]