UT: Add type hints to test_file_agent_log_repository.py

This commit is contained in:
Mike Salvatore 2022-09-28 12:55:58 -04:00
parent d49d16bc37
commit 35d0cbc3b0
1 changed files with 5 additions and 4 deletions

View File

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