forked from p34709852/monkey
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:
parent
c4642141f0
commit
1dc72e45e7
|
@ -25,20 +25,12 @@ def mock_agent_signals_service():
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def flask_client_builder(build_flask_client, mock_agent_signals_service):
|
def flask_client(build_flask_client, mock_agent_signals_service):
|
||||||
def inner(side_effect=None):
|
|
||||||
container = StubDIContainer()
|
container = StubDIContainer()
|
||||||
container.register_instance(AgentSignalsService, mock_agent_signals_service)
|
container.register_instance(AgentSignalsService, mock_agent_signals_service)
|
||||||
|
|
||||||
with build_flask_client(container) as flask_client:
|
with build_flask_client(container) as flask_client:
|
||||||
return flask_client
|
yield flask_client
|
||||||
|
|
||||||
return inner
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def flask_client(flask_client_builder):
|
|
||||||
return flask_client_builder()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|
|
@ -11,23 +11,15 @@ TIMESTAMP = 123456789
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def flask_client_builder(build_flask_client):
|
def flask_client(build_flask_client):
|
||||||
def inner(side_effect=None):
|
|
||||||
container = StubDIContainer()
|
container = StubDIContainer()
|
||||||
|
|
||||||
mock_island_event_queue = MagicMock(spec=IIslandEventQueue)
|
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)
|
container.register_instance(IIslandEventQueue, mock_island_event_queue)
|
||||||
|
|
||||||
with build_flask_client(container) as flask_client:
|
with build_flask_client(container) as flask_client:
|
||||||
return flask_client
|
yield flask_client
|
||||||
|
|
||||||
return inner
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def flask_client(flask_client_builder):
|
|
||||||
return flask_client_builder()
|
|
||||||
|
|
||||||
|
|
||||||
def test_terminate_all_agents_post(flask_client):
|
def test_terminate_all_agents_post(flask_client):
|
||||||
|
|
Loading…
Reference in New Issue