Skip to content

Commit f98c55d

Browse files
committed
sort-of fake messagebus on fake-uow. [fake_messagebus]
1 parent 4c60971 commit f98c55d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎tests/unit/test_handlers.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from datetime import date
22
from unittest import mock
3+
from typing import List
34
import pytest
45

56
from allocation.adapters import repository
@@ -125,3 +126,15 @@ def test_reallocates_if_necessary():
125126
assert batch1.available_quantity == 5
126127
# and 20 will be reallocated to the next batch
127128
assert batch2.available_quantity == 30
129+
130+
131+
class FakeUnitOfWorkWithFakeMessageBus(FakeUnitOfWork):
132+
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)