Skip to content

Commit 73f3576

Browse files
committed
new service test for deallocation
1 parent 5e3e7ae commit 73f3576

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎test_services.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,24 @@ def test_commits():
5151

5252
services.allocate(line, repo, session)
5353
assert session.committed is True
54+
55+
56+
def test_deallocate_decrements_available_quantity():
57+
repo, session = FakeRepository([]), FakeSession()
58+
# TODO: you'll need to implement the services.add_batch method
59+
services.add_batch("b1", "BLUE-PLINTH", 100, None, repo, session)
60+
line = model.OrderLine("o1", "BLUE-PLINTH", 10)
61+
services.allocate(line, repo, session)
62+
batch = repo.get(reference="b1")
63+
assert batch.available_quantity == 90
64+
# services.deallocate(...
65+
...
66+
assert batch.available_quantity == 100
67+
68+
69+
def test_deallocate_decrements_correct_quantity():
70+
... # TODO - check that we decrement the right sku
71+
72+
73+
def test_trying_to_deallocate_unallocated_batch():
74+
... # TODO: should this error or pass silently? up to you.

0 commit comments

Comments
 (0)