From 35d0cbc3b058453d3b8d19f22e041dd314b16682 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 28 Sep 2022 12:55:58 -0400 Subject: [PATCH] UT: Add type hints to test_file_agent_log_repository.py --- .../cc/repository/test_file_agent_log_repository.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/repository/test_file_agent_log_repository.py b/monkey/tests/unit_tests/monkey_island/cc/repository/test_file_agent_log_repository.py index ac841096b..4ff7f904e 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/repository/test_file_agent_log_repository.py +++ b/monkey/tests/unit_tests/monkey_island/cc/repository/test_file_agent_log_repository.py @@ -7,6 +7,7 @@ from tests.monkey_island import OpenErrorFileRepository, SingleFileRepository from monkey_island.cc.repository import ( FileAgentLogRepository, + IAgentLogRepository, IFileRepository, RetrievalError, UnknownRecordError, @@ -17,18 +18,18 @@ AGENT_ID = UUID("6bfd8b64-43d8-4449-8c70-d898aca74ad8") @pytest.fixture -def repository(): +def repository() -> IAgentLogRepository: return FileAgentLogRepository(SingleFileRepository()) -def test_store_agent_log(repository): +def test_store_agent_log(repository: IAgentLogRepository): repository.upsert_agent_log(AGENT_ID, LOG_CONTENTS) retrieved_log_contents = repository.get_agent_log(AGENT_ID) assert retrieved_log_contents == LOG_CONTENTS -def test_get_agent_log__unknown_record_error(repository): +def test_get_agent_log__unknown_record_error(repository: IAgentLogRepository): with pytest.raises(UnknownRecordError): repository.get_agent_log(AGENT_ID) @@ -48,7 +49,7 @@ def test_get_agent_log__corrupt_data(): repository.get_agent_log(AGENT_ID) -def test_reset_agent_logs(repository): +def test_reset_agent_logs(repository: IAgentLogRepository): repository.upsert_agent_log(AGENT_ID, LOG_CONTENTS) repository.reset() with pytest.raises(UnknownRecordError):