From 619dc68c0efa45fdfad55e0947dfbb0e15737d6e Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Fri, 16 Sep 2022 12:19:24 +0530 Subject: [PATCH] UT: Use IAgentEventSerializer in place of IEventSerializer --- .../event_serializers/test_event_serializer_registry.py | 8 ++++---- .../event_serializers/test_pydantic_event_serializer.py | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/monkey/tests/unit_tests/common/event_serializers/test_event_serializer_registry.py b/monkey/tests/unit_tests/common/event_serializers/test_event_serializer_registry.py index f83c54ba4..f918ede23 100644 --- a/monkey/tests/unit_tests/common/event_serializers/test_event_serializer_registry.py +++ b/monkey/tests/unit_tests/common/event_serializers/test_event_serializer_registry.py @@ -3,7 +3,7 @@ from unittest.mock import MagicMock import pytest from pydantic import Field -from common.event_serializers import EventSerializerRegistry, IEventSerializer +from common.event_serializers import EventSerializerRegistry, IAgentEventSerializer from common.events import AbstractAgentEvent @@ -19,8 +19,8 @@ class NoneEvent(AbstractAgentEvent): none_param: float = Field(default=1.0) -SOME_SERIALIZER = MagicMock(spec=IEventSerializer) -OTHER_SERIALIZER = MagicMock(spec=IEventSerializer) +SOME_SERIALIZER = MagicMock(spec=IAgentEventSerializer) +OTHER_SERIALIZER = MagicMock(spec=IAgentEventSerializer) @pytest.fixture @@ -50,7 +50,7 @@ def test_event_serializer_registry_set_unsupported_type(event_serializer_registr def test_event_serializer_registry_set_unsupported_type_key(event_serializer_registry): with pytest.raises(TypeError): - event_serializer_registry["BogusKey"] = MagicMock(spec=IEventSerializer) + event_serializer_registry["BogusKey"] = MagicMock(spec=IAgentEventSerializer) def test_event_serializer_registry_get_unsuported_type(event_serializer_registry): diff --git a/monkey/tests/unit_tests/common/event_serializers/test_pydantic_event_serializer.py b/monkey/tests/unit_tests/common/event_serializers/test_pydantic_event_serializer.py index 4958f0303..cd545e432 100644 --- a/monkey/tests/unit_tests/common/event_serializers/test_pydantic_event_serializer.py +++ b/monkey/tests/unit_tests/common/event_serializers/test_pydantic_event_serializer.py @@ -5,7 +5,11 @@ from uuid import UUID import pytest from pydantic import Field -from common.event_serializers import EVENT_TYPE_FIELD, IEventSerializer, PydanticEventSerializer +from common.event_serializers import ( + EVENT_TYPE_FIELD, + IAgentEventSerializer, + PydanticEventSerializer, +) from common.events import AbstractAgentEvent AGENT_ID = UUID("f811ad00-5a68-4437-bd51-7b5cc1768ad5") @@ -26,7 +30,7 @@ class PydanticEvent(AbstractAgentEvent): @pytest.fixture -def pydantic_event_serializer() -> IEventSerializer: +def pydantic_event_serializer() -> IAgentEventSerializer: return PydanticEventSerializer(PydanticEvent)