Skip to content

Commit

Permalink
new service test for deallocation
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwp committed Feb 24, 2021
1 parent 5e3e7ae commit 7efebb6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,22 @@ def test_commits():

services.allocate(line, repo, session)
assert session.committed is True


def test_deallocate_decrements_available_quantity():
repo, session = FakeRepository([]), FakeSession()
services.add_batch("b1", "BLUE-PLINTH", 100, None, repo, session)
services.allocate("o1", "BLUE-PLINTH", 10, repo, session)
batch = repo.get(reference="b1")
assert batch.available_quantity == 90
# services.deallocate(...
...
assert batch.available_quantity == 100


def test_deallocate_decrements_correct_quantity():
... # TODO


def test_trying_to_deallocate_unallocated_batch():
... # TODO: should this error or pass silently? up to you.

0 comments on commit 7efebb6

Please sign in to comment.