Skip to content

Commit 1cad6e8

Browse files
committed
sort-of fake messagebus on fake-uow. [fake_messagebus]
1 parent be5b945 commit 1cad6e8

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎tests/unit/test_handlers.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# pylint: disable=no-self-use
22
from datetime import date
33
from unittest import mock
4+
from typing import List
45
import pytest
56

67
from allocation.adapters import repository
@@ -126,3 +127,14 @@ def test_reallocates_if_necessary(self):
126127
assert batch1.available_quantity == 5
127128
# and 20 will be reallocated to the next batch
128129
assert batch2.available_quantity == 30
130+
131+
132+
class FakeUnitOfWorkWithFakeMessageBus(FakeUnitOfWork):
133+
def __init__(self):
134+
super().__init__()
135+
self.events_published = [] # type: List[events.Event]
136+
137+
def publish_events(self):
138+
for product in self.products.seen:
139+
while product.events:
140+
self.events_published.append(product.events.pop(0))

0 commit comments

Comments
 (0)