diff --git a/monkey/monkey_island/cc/setup/mongo/database_initializer.py b/monkey/monkey_island/cc/setup/mongo/database_initializer.py index 9a6054ca4..35b22b87f 100644 --- a/monkey/monkey_island/cc/setup/mongo/database_initializer.py +++ b/monkey/monkey_island/cc/setup/mongo/database_initializer.py @@ -32,7 +32,7 @@ def _try_store_mitigations_on_mongo(): mitigation_collection_name = AttackMitigations.COLLECTION_NAME try: mongo.db.validate_collection(mitigation_collection_name) - if mongo.db.attack_mitigations.count() == 0: + if mongo.db.attack_mitigations.count_documents({}) == 0: raise errors.OperationFailure( "Mitigation collection empty. Try dropping the collection and running again" ) diff --git a/monkey/tests/unit_tests/monkey_island/cc/services/reporting/test_stolen_credentials.py b/monkey/tests/unit_tests/monkey_island/cc/services/reporting/test_stolen_credentials.py index e3a7f6570..7a0e0aeca 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/reporting/test_stolen_credentials.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/reporting/test_stolen_credentials.py @@ -35,7 +35,7 @@ def fake_monkey(): return monkey.id -@pytest.mark.usefixture("uses_database") +@pytest.mark.usefixtures("uses_database") def test_get_credentials(fake_monkey): StolenCredentials( identities=fake_credentials["identities"],