Exemplo n.º 1
0
 def test_parse_event_with_valid_event(self):
     test_event = Event(name="event:test",
                        version="2",
                        id=str(uuid4()),
                        flow_id=str(uuid4()))
     test_json = test_event.to_json()
     event_processor = AsyncEventProcessor()
     event = event_processor.parse_event(test_json)
     self.assertEqual(event, test_event)
Exemplo n.º 2
0
 async def test_process_event_founding_none_event(self):
     test_event = Event(name="event:test",
                        version="2",
                        id=str(uuid4()),
                        flow_id=str(uuid4()))
     test_json = test_event.to_json()
     event_processor = AsyncEventProcessor()
     event = await event_processor.process_event(test_json)
     response: ResponseEvent = ResponseEvent.from_json(event)
     self.assertTrue(response.is_error)
     self.assertEqual(response.event_type, EventErrorType.NOT_FOUND)
Exemplo n.º 3
0
 async def test_process_event_founding_fake_event(self):
     FakeRegister.register_event()
     test_event = Event(
         name=FakeRegister.event_name,
         version=FakeRegister.event_version,
         id=str(uuid4()),
         flow_id=str(uuid4()),
         payload={},
     )
     test_json = test_event.to_json()
     event_processor = AsyncEventProcessor()
     response = await event_processor.process_event(test_json)
     self.assertEqual(test_json, response)