From b5afbe7218134904d9d5374c84d955605a3b68b8 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 5 Aug 2022 08:42:06 +0200 Subject: [PATCH 1/3] Island: Export authentication resources from __init__ --- monkey/monkey_island/cc/resources/auth/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/monkey/monkey_island/cc/resources/auth/__init__.py b/monkey/monkey_island/cc/resources/auth/__init__.py index e69de29bb..d73489248 100644 --- a/monkey/monkey_island/cc/resources/auth/__init__.py +++ b/monkey/monkey_island/cc/resources/auth/__init__.py @@ -0,0 +1,3 @@ +from .authenticate import Authenticate, init_jwt +from .register import Register +from .registration_status import RegistrationStatus From 509716338c0988d082923cae5f1378ec65598dd6 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 5 Aug 2022 08:42:54 +0200 Subject: [PATCH 2/3] UT: Shorten import for authentication resources --- .../monkey_island/cc/resources/auth/test_authenticate.py | 2 +- .../unit_tests/monkey_island/cc/resources/auth/test_register.py | 2 +- .../monkey_island/cc/resources/auth/test_registration_status.py | 2 +- monkey/tests/unit_tests/monkey_island/cc/resources/conftest.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_authenticate.py b/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_authenticate.py index 6d5af8a94..ab0184262 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_authenticate.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_authenticate.py @@ -4,7 +4,7 @@ from unittest.mock import MagicMock import pytest from common.utils.exceptions import IncorrectCredentialsError -from monkey_island.cc.resources.auth.authenticate import Authenticate +from monkey_island.cc.resources.auth import Authenticate USERNAME = "test_user" PASSWORD = "test_password" diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_register.py b/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_register.py index aee054f84..a759c2fc3 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_register.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_register.py @@ -4,7 +4,7 @@ from unittest.mock import MagicMock import pytest from common.utils.exceptions import AlreadyRegisteredError, InvalidRegistrationCredentialsError -from monkey_island.cc.resources.auth.register import Register +from monkey_island.cc.resources.auth import Register REGISTRATION_URL = Register.urls[0] diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_registration_status.py b/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_registration_status.py index 350590df8..76d6406a9 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_registration_status.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/auth/test_registration_status.py @@ -2,7 +2,7 @@ from unittest.mock import MagicMock import pytest -from monkey_island.cc.resources.auth.registration_status import RegistrationStatus +from monkey_island.cc.resources.auth import RegistrationStatus REGISTRATION_STATUS_URL = RegistrationStatus.urls[0] diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/conftest.py b/monkey/tests/unit_tests/monkey_island/cc/resources/conftest.py index 4fb2e7be3..1b914b3e0 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/conftest.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/conftest.py @@ -7,7 +7,7 @@ from tests.monkey_island import OpenErrorFileRepository from tests.unit_tests.monkey_island.conftest import init_mock_app import monkey_island.cc.app -import monkey_island.cc.resources.auth.authenticate +import monkey_island.cc.resources.auth import monkey_island.cc.resources.island_mode from monkey_island.cc.repository import IFileRepository From 2e6b3092e81259aa1031e079c37eb6eafe8bd5b4 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 5 Aug 2022 08:43:27 +0200 Subject: [PATCH 3/3] Island: Shorten imports for authenticaiton resources --- monkey/monkey_island/cc/app.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index cd7d46018..0360f5367 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -22,9 +22,7 @@ from monkey_island.cc.resources.AbstractResource import AbstractResource from monkey_island.cc.resources.agent_configuration import AgentConfiguration from monkey_island.cc.resources.agent_controls import StopAgentCheck, StopAllAgents from monkey_island.cc.resources.attack.attack_report import AttackReport -from monkey_island.cc.resources.auth.authenticate import Authenticate, init_jwt -from monkey_island.cc.resources.auth.register import Register -from monkey_island.cc.resources.auth.registration_status import RegistrationStatus +from monkey_island.cc.resources.auth import Authenticate, Register, RegistrationStatus, init_jwt from monkey_island.cc.resources.blackbox.log_blackbox_endpoint import LogBlackboxEndpoint from monkey_island.cc.resources.blackbox.monkey_blackbox_endpoint import MonkeyBlackboxEndpoint from monkey_island.cc.resources.blackbox.telemetry_blackbox_endpoint import (