Skip to content

Commit 344cf81

Browse files
committed
modify allocate handler to no longer return anything
1 parent f6833ff commit 344cf81

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/allocation/service_layer/handlers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ def add_batch(
2828
def allocate(
2929
cmd: commands.Allocate,
3030
uow: unit_of_work.AbstractUnitOfWork,
31-
) -> str:
31+
):
3232
line = OrderLine(cmd.orderid, cmd.sku, cmd.qty)
3333
with uow:
3434
product = uow.products.get(sku=line.sku)
3535
if product is None:
3636
raise InvalidSku(f"Invalid sku {line.sku}")
37-
batchref = product.allocate(line)
37+
product.allocate(line)
3838
uow.commit()
39-
return batchref
4039

4140

4241
def change_batch_quantity(

tests/unit/test_handlers.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ def test_allocates(self):
6565
messagebus.handle(
6666
commands.CreateBatch("batch1", "COMPLICATED-LAMP", 100, None), uow
6767
)
68-
results = messagebus.handle(
69-
commands.Allocate("o1", "COMPLICATED-LAMP", 10), uow
70-
)
71-
assert results.pop(0) == "batch1"
68+
messagebus.handle(commands.Allocate("o1", "COMPLICATED-LAMP", 10), uow)
7269
[batch] = uow.products.get("COMPLICATED-LAMP").batches
7370
assert batch.available_quantity == 90
7471

0 commit comments

Comments
 (0)