Skip to content

Commit ad26a08

Browse files
committed
test allocate twice [last_test]
1 parent b2d618a commit ad26a08

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test_batches.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from datetime import date
22
from model import Batch, OrderLine
3-
from datetime import date
43

54

65
def test_allocating_to_a_batch_reduces_the_available_quantity():
@@ -36,6 +35,13 @@ def test_cannot_allocate_if_skus_do_not_match():
3635
assert batch.can_allocate(different_sku_line) is False
3736

3837

38+
def test_allocation_is_idempotent():
39+
batch, line = make_batch_and_line("ANGULAR-DESK", 20, 2)
40+
batch.allocate(line)
41+
batch.allocate(line)
42+
assert batch.available_quantity == 18
43+
44+
3945
def test_deallocate():
4046
batch, line = make_batch_and_line("EXPENSIVE-FOOTSTOOL", 20, 2)
4147
batch.allocate(line)

0 commit comments

Comments
 (0)