diff --git a/monkey/monkey_island/cc/repository/mongo_credentials_repository.py b/monkey/monkey_island/cc/repository/mongo_credentials_repository.py index 971a2bf5d..4ef4acda2 100644 --- a/monkey/monkey_island/cc/repository/mongo_credentials_repository.py +++ b/monkey/monkey_island/cc/repository/mongo_credentials_repository.py @@ -30,6 +30,7 @@ class MongoCredentialsRepository(ICredentialsRepository): for c in list_stolen_credentials: del c["_id"] stolen_credentials.append(Credentials.from_mapping(c)) + return stolen_credentials except Exception as err: raise RetrievalError(err) @@ -44,6 +45,7 @@ class MongoCredentialsRepository(ICredentialsRepository): raise err def save_configured_credentials(self, credentials: Sequence[Credentials]): + # TODO: Fix deduplication of Credentials in mongo try: for c in credentials: mongo.db.configured_credentials.insert_one(Credentials.to_mapping(c)) @@ -51,6 +53,7 @@ class MongoCredentialsRepository(ICredentialsRepository): raise StorageError(err) def save_stolen_credentials(self, credentials: Sequence[Credentials]): + # TODO: Fix deduplication of Credentials in mongo try: for c in credentials: mongo.db.stolen_credentials.insert_one(Credentials.to_mapping(c)) diff --git a/monkey/tests/unit_tests/monkey_island/cc/repository/test_mongo_credentials_repository.py b/monkey/tests/unit_tests/monkey_island/cc/repository/test_mongo_credentials_repository.py index 8d32b961b..0a96bc9c6 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/repository/test_mongo_credentials_repository.py +++ b/monkey/tests/unit_tests/monkey_island/cc/repository/test_mongo_credentials_repository.py @@ -78,7 +78,6 @@ def test_mongo_repository_configured(fake_mongo): ] mongo_repository = MongoCredentialsRepository() - mongo_repository.save_configured_credentials(credentials) actual_configured_credentials = mongo_repository.get_configured_credentials() @@ -99,7 +98,6 @@ def test_mongo_repository_stolen(fake_mongo): configured_credentials = [Credentials.from_mapping(CREDENTIALS_DICT_2)] mongo_repository = MongoCredentialsRepository() - mongo_repository.save_configured_credentials(configured_credentials) mongo_repository.save_stolen_credentials(stolen_credentials) @@ -127,7 +125,6 @@ def test_mongo_repository_all(fake_mongo): ] mongo_repository = MongoCredentialsRepository() - mongo_repository.save_configured_credentials(configured_credentials) mongo_repository.save_stolen_credentials(stolen_credentials)