Island: Add note to fix duplication of Credentials in database
This commit is contained in:
parent
45a6693263
commit
c808d50948
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue