diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/test_agent_signals.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_agent_signals.py index 3f644e051..e7a20a9c9 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/test_agent_signals.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_agent_signals.py @@ -25,20 +25,12 @@ def mock_agent_signals_service(): @pytest.fixture -def flask_client_builder(build_flask_client, mock_agent_signals_service): - def inner(side_effect=None): - container = StubDIContainer() - container.register_instance(AgentSignalsService, mock_agent_signals_service) +def flask_client(build_flask_client, mock_agent_signals_service): + container = StubDIContainer() + container.register_instance(AgentSignalsService, mock_agent_signals_service) - with build_flask_client(container) as flask_client: - return flask_client - - return inner - - -@pytest.fixture -def flask_client(flask_client_builder): - return flask_client_builder() + with build_flask_client(container) as flask_client: + yield flask_client @pytest.mark.parametrize( diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/test_terminate_all_agents.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_terminate_all_agents.py index 305293f26..bcf91afd4 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/test_terminate_all_agents.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_terminate_all_agents.py @@ -11,23 +11,15 @@ TIMESTAMP = 123456789 @pytest.fixture -def flask_client_builder(build_flask_client): - def inner(side_effect=None): - container = StubDIContainer() +def flask_client(build_flask_client): + container = StubDIContainer() - mock_island_event_queue = MagicMock(spec=IIslandEventQueue) - mock_island_event_queue.publish.side_effect = side_effect - container.register_instance(IIslandEventQueue, mock_island_event_queue) + mock_island_event_queue = MagicMock(spec=IIslandEventQueue) + mock_island_event_queue.publish.side_effect = None + container.register_instance(IIslandEventQueue, mock_island_event_queue) - with build_flask_client(container) as flask_client: - return flask_client - - return inner - - -@pytest.fixture -def flask_client(flask_client_builder): - return flask_client_builder() + with build_flask_client(container) as flask_client: + yield flask_client def test_terminate_all_agents_post(flask_client):