Island: Add note to fix duplication of Credentials in database

This commit is contained in:
Ilija Lazoroski 2022-07-08 17:50:18 +02:00
parent 45a6693263
commit c808d50948
2 changed files with 3 additions and 3 deletions

View File

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

View File

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