Exemplo n.º 1
0
    async def test_two_events_mixed_order(self):
        second_event = factories.get_broadcast_event(2)
        await events.handler.EventHandler.new(second_event)

        self.assertEqual(await events.handler.EventHandler.get_seq_no(), 0)

        first_event = factories.get_broadcast_event(1)
        await events.handler.EventHandler.new(first_event)
        self.assertEqual(await events.handler.EventHandler.get_seq_no(), 2)
Exemplo n.º 2
0
    async def test_four_events_mixed_order(self):
        fourth_event = factories.get_broadcast_event(4)
        await events.handler.EventHandler.new(fourth_event)

        self.assertEqual(await events.handler.EventHandler.get_seq_no(), 0)

        second_event = factories.get_broadcast_event(2)
        await events.handler.EventHandler.new(second_event)

        self.assertEqual(await events.handler.EventHandler.get_seq_no(), 0)

        first_event = factories.get_broadcast_event(1)
        await events.handler.EventHandler.new(first_event)

        self.assertEqual(await events.handler.EventHandler.get_seq_no(), 2)

        third_event = factories.get_broadcast_event(3)
        await events.handler.EventHandler.new(third_event)

        self.assertEqual(await events.handler.EventHandler.get_seq_no(), 4)
Exemplo n.º 3
0
 async def test_one_event_out_order(self):
     event = factories.get_broadcast_event(2)
     await events.handler.EventHandler.new(event)
     self.assertEqual(await events.handler.EventHandler.get_seq_no(), 0)