UT: Remove unnecessary wrapper around pytest fixture flask_client in test_terminate_all_agents.py and test_agent_signals.py

This commit is contained in:
Shreya Malviya 2022-09-23 18:45:33 +05:30 committed by Mike Salvatore
parent c4642141f0
commit 1dc72e45e7
2 changed files with 12 additions and 28 deletions

View File

@ -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):
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()
yield flask_client
@pytest.mark.parametrize(

View File

@ -11,23 +11,15 @@ TIMESTAMP = 123456789
@pytest.fixture
def flask_client_builder(build_flask_client):
def inner(side_effect=None):
def flask_client(build_flask_client):
container = StubDIContainer()
mock_island_event_queue = MagicMock(spec=IIslandEventQueue)
mock_island_event_queue.publish.side_effect = side_effect
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()
yield flask_client
def test_terminate_all_agents_post(flask_client):