From 5f44204583ebb9fc9c1d16cce192acf07a935216 Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Wed, 14 Sep 2022 18:38:56 +0000 Subject: [PATCH] UT: Clean up mongo fixture --- .../cc/repository/test_mongo_event_repository.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/repository/test_mongo_event_repository.py b/monkey/tests/unit_tests/monkey_island/cc/repository/test_mongo_event_repository.py index ac5a02f34..4e9012443 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/repository/test_mongo_event_repository.py +++ b/monkey/tests/unit_tests/monkey_island/cc/repository/test_mongo_event_repository.py @@ -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.events = MagicMock(spec=mongomock.Collection) - # The first call to find() must succeed - 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.find = MagicMock(side_effect=Exception("some exception")) mongo_client.monkey_island.events.insert_one = MagicMock( 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")) return mongo_client