UT: Simplify some logic in test_island_mode.py's flask_client fixture

This commit is contained in:
Shreya Malviya 2022-09-21 18:09:13 +05:30
parent 10e1177ef6
commit 1afafd20dd
1 changed files with 3 additions and 5 deletions

View File

@ -18,12 +18,10 @@ def flask_client(build_flask_client):
in_memory_simulation_repository = InMemorySimulationRepository()
container.register_instance(ISimulationRepository, in_memory_simulation_repository)
def wrap_in_memory_simulation_repository_set_mode(topic, event):
mode = event
in_memory_simulation_repository.set_mode(mode)
mock_island_event_queue = MagicMock(spec=IIslandEventQueue)
mock_island_event_queue.publish.side_effect = wrap_in_memory_simulation_repository_set_mode
mock_island_event_queue.publish.side_effect = (
lambda topic, mode: in_memory_simulation_repository.set_mode(mode)
)
container.register_instance(IIslandEventQueue, mock_island_event_queue)
with build_flask_client(container) as flask_client: