forked from p15670423/monkey
Island: Add reset_to_default() to FileAgentConfigurationRepository
This commit is contained in:
parent
aa7509e49f
commit
e293639a22
|
@ -35,3 +35,6 @@ class FileAgentConfigurationRepository(IAgentConfigurationRepository):
|
|||
self._file_repository.save_file(
|
||||
AGENT_CONFIGURATION_FILE_NAME, io.BytesIO(configuration_json.encode())
|
||||
)
|
||||
|
||||
def reset_to_default(self):
|
||||
self.store_configuration(self._default_agent_configuration)
|
||||
|
|
|
@ -33,3 +33,13 @@ def test_get_agent_config_retrieval_error(default_agent_configuration):
|
|||
|
||||
with pytest.raises(RetrievalError):
|
||||
repository.get_configuration()
|
||||
|
||||
|
||||
def test_reset_to_default(repository, default_agent_configuration):
|
||||
agent_configuration = AgentConfiguration.from_mapping(AGENT_CONFIGURATION)
|
||||
|
||||
repository.store_configuration(agent_configuration)
|
||||
repository.reset_to_default()
|
||||
retrieved_agent_configuration = repository.get_configuration()
|
||||
|
||||
assert retrieved_agent_configuration == default_agent_configuration
|
||||
|
|
Loading…
Reference in New Issue