Island, UT: Use count_documents instead of count

* count() is deprecated
* pytest.mark.usefixtureS
This commit is contained in:
Ilija Lazoroski 2022-04-05 12:48:18 +02:00 committed by Mike Salvatore
parent 943cb2fa7a
commit 8248004bce
2 changed files with 2 additions and 2 deletions

View File

@ -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"
)

View File

@ -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"],