forked from p15670423/monkey
UT: Clean up mongo fixture
This commit is contained in:
parent
7e96c11204
commit
5f44204583
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue