Skip to content

Commit c76a54f

Browse files
committed
services tests partially converted to primitives [tests_call_with_primitives]
1 parent 34dbe91 commit c76a54f

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

‎test_services.py‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,25 @@ def commit(self):
2727

2828

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

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

3736

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

4341
with pytest.raises(services.InvalidSku, match="Invalid sku NONEXISTENTSKU"):
44-
services.allocate(line, repo, FakeSession())
42+
services.allocate("o1", "NONEXISTENTSKU", 10, repo, FakeSession())
4543

4644

4745
def test_commits():
48-
line = model.OrderLine('o1', 'OMINOUS-MIRROR', 10)
49-
batch = model.Batch('b1', 'OMINOUS-MIRROR', 100, eta=None)
46+
batch = model.Batch("b1", "OMINOUS-MIRROR", 100, eta=None)
5047
repo = FakeRepository([batch])
5148
session = FakeSession()
5249

53-
services.allocate(line, repo, session)
50+
services.allocate("o1", "OMINOUS-MIRROR", 10, repo, session)
5451
assert session.committed is True

0 commit comments

Comments
 (0)