Skip to content

Commit 40148af

Browse files
committed
modify allocate handler to no longer return anything
1 parent cff6a66 commit 40148af

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/allocation/service_layer/handlers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ def add_batch(
2727

2828
def allocate(
2929
cmd: commands.Allocate, uow: unit_of_work.AbstractUnitOfWork
30-
) -> str:
30+
):
3131
line = OrderLine(cmd.orderid, cmd.sku, cmd.qty)
3232
with uow:
3333
product = uow.products.get(sku=line.sku)
3434
if product is None:
3535
raise InvalidSku(f'Invalid sku {line.sku}')
36-
batchref = product.allocate(line)
36+
product.allocate(line)
3737
uow.commit()
38-
return batchref
3938

4039

4140
def change_batch_quantity(

tests/unit/test_handlers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ def test_allocates(self):
7373
messagebus.handle(
7474
commands.CreateBatch("batch1", "COMPLICATED-LAMP", 100, None), uow
7575
)
76-
results = messagebus.handle(
76+
messagebus.handle(
7777
commands.Allocate("o1", "COMPLICATED-LAMP", 10), uow
7878
)
79-
assert results.pop(0) == "batch1"
8079
[batch] = uow.products.get("COMPLICATED-LAMP").batches
8180
assert batch.available_quantity == 90
8281

0 commit comments

Comments
 (0)