Island: Add reset_to_default() to FileAgentConfigurationRepository

This commit is contained in:
Mike Salvatore 2022-06-30 10:03:21 -04:00
parent aa7509e49f
commit e293639a22
2 changed files with 13 additions and 0 deletions

View File

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

View File

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