UT: Clean up mongo fixture

This commit is contained in:
Kekoa Kaaikala 2022-09-14 18:38:56 +00:00
parent 7e96c11204
commit 5f44204583
1 changed files with 1 additions and 9 deletions

View File

@ -61,18 +61,10 @@ def error_raising_mongo_client(mongo_client) -> mongomock.MongoClient:
mongo_client.monkey_island = MagicMock(spec=mongomock.Database) mongo_client.monkey_island = MagicMock(spec=mongomock.Database)
mongo_client.monkey_island.events = MagicMock(spec=mongomock.Collection) mongo_client.monkey_island.events = MagicMock(spec=mongomock.Collection)
# The first call to find() must succeed mongo_client.monkey_island.events.find = MagicMock(side_effect=Exception("some exception"))
mongo_client.monkey_island.events.find = MagicMock(
# side_effect=chain([MagicMock()], repeat(Exception("some exception")))
side_effect=Exception("some exception")
)
mongo_client.monkey_island.events.find_one = MagicMock(side_effect=Exception("some exception"))
mongo_client.monkey_island.events.insert_one = MagicMock( mongo_client.monkey_island.events.insert_one = MagicMock(
side_effect=Exception("some exception") side_effect=Exception("some exception")
) )
mongo_client.monkey_island.events.replace_one = MagicMock(
side_effect=Exception("some exception")
)
mongo_client.monkey_island.events.drop = MagicMock(side_effect=Exception("some exception")) mongo_client.monkey_island.events.drop = MagicMock(side_effect=Exception("some exception"))
return mongo_client return mongo_client