Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08651a5

Browse files
committed
FakeRepository [fake_repo]
1 parent 7f3fda2 commit 08651a5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test_services.py

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

66

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

0 commit comments

Comments
 (0)