forked from p15670423/monkey
Island: Add ICredentialsRepository.reset()
This commit is contained in:
parent
07815eed93
commit
3fd27c6503
|
@ -84,3 +84,10 @@ class ICredentialsRepository(ABC):
|
|||
:raises RemovalError: If an error is encountered while attempting to remove the credentials
|
||||
"""
|
||||
pass
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
An alias for remove_all_credentials()
|
||||
|
||||
:raises RemovalError: If an error is encountered while attempting to remove the credentials
|
||||
"""
|
||||
|
|
|
@ -52,6 +52,9 @@ class MongoCredentialsRepository(ICredentialsRepository):
|
|||
self.remove_configured_credentials()
|
||||
self.remove_stolen_credentials()
|
||||
|
||||
def reset(self):
|
||||
self.remove_all_credentials()
|
||||
|
||||
def _get_credentials_from_collection(self, collection) -> Sequence[Credentials]:
|
||||
try:
|
||||
collection_result = []
|
||||
|
|
|
@ -33,3 +33,6 @@ class InMemoryCredentialsRepository(ICredentialsRepository):
|
|||
def remove_all_credentials(self):
|
||||
self.remove_configured_credentials()
|
||||
self.remove_stolen_credentials()
|
||||
|
||||
def reset(self):
|
||||
self.remove_all_credentials()
|
||||
|
|
|
@ -142,6 +142,11 @@ def test_mongo_repository_remove_credentials__removal_error(error_raising_creden
|
|||
error_raising_credentials_repository.remove_stolen_credentials()
|
||||
|
||||
|
||||
def test_mongo_repository_reset__removal_error(error_raising_credentials_repository):
|
||||
with pytest.raises(RemovalError):
|
||||
error_raising_credentials_repository.reset()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("credentials", CREDENTIALS)
|
||||
def test_configured_secrets_encrypted(
|
||||
mongo_repository: MongoCredentialsRepository,
|
||||
|
|
Loading…
Reference in New Issue