Skip to content

Commit f341bee

Browse files
committed
services tests partially converted to primitives [tests_call_with_primitives]
1 parent c5822aa commit f341bee

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tests/unit/test_services.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,25 @@ def commit(self):
2626

2727

2828
def test_returns_allocation():
29-
line = model.OrderLine("o1", "COMPLICATED-LAMP", 10)
30-
batch = model.Batch("b1", "COMPLICATED-LAMP", 100, eta=None)
29+
batch = model.Batch("batch1", "COMPLICATED-LAMP", 100, eta=None)
3130
repo = FakeRepository([batch])
3231

33-
result = services.allocate(line, repo, FakeSession())
34-
assert result == "b1"
32+
result = services.allocate("o1", "COMPLICATED-LAMP", 10, repo, FakeSession())
33+
assert result == "batch1"
3534

3635

3736
def test_error_for_invalid_sku():
38-
line = model.OrderLine("o1", "NONEXISTENTSKU", 10)
3937
batch = model.Batch("b1", "AREALSKU", 100, eta=None)
4038
repo = FakeRepository([batch])
4139

4240
with pytest.raises(services.InvalidSku, match="Invalid sku NONEXISTENTSKU"):
43-
services.allocate(line, repo, FakeSession())
41+
services.allocate("o1", "NONEXISTENTSKU", 10, repo, FakeSession())
4442

4543

4644
def test_commits():
47-
line = model.OrderLine("o1", "OMINOUS-MIRROR", 10)
4845
batch = model.Batch("b1", "OMINOUS-MIRROR", 100, eta=None)
4946
repo = FakeRepository([batch])
5047
session = FakeSession()
5148

52-
services.allocate(line, repo, session)
49+
services.allocate("o1", "OMINOUS-MIRROR", 10, repo, session)
5350
assert session.committed is True

0 commit comments

Comments
 (0)