Skip to content

Commit 9fe9a3d

Browse files
committed
FakeRepository [fake_repo]
1 parent a1903fa commit 9fe9a3d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test_services.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
import pytest
2-
32
import model
3+
import repository
44
import services
55

66

7+
class FakeRepository(repository.AbstractRepository):
8+
def __init__(self, batches):
9+
self._batches = set(batches)
10+
11+
def add(self, batch):
12+
self._batches.add(batch)
13+
14+
def get(self, reference):
15+
return next(b for b in self._batches if b.reference == reference)
16+
17+
def list(self):
18+
return list(self._batches)
19+
20+
721
def test_returns_allocation():
822
line = model.OrderLine("o1", "COMPLICATED-LAMP", 10)
923
batch = model.Batch("b1", "COMPLICATED-LAMP", 100, eta=None)

0 commit comments

Comments
 (0)