Skip to content

Commit 679a763

Browse files
committed
fake repo get_by_batchref [fakerepo_get_by_batchref]
1 parent a097126 commit 679a763

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/unit/test_handlers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ def _add(self, product):
1919
def _get(self, sku):
2020
return next((p for p in self._products if p.sku == sku), None)
2121

22+
def _get_by_batchref(self, batchref):
23+
return next((
24+
p for p in self._products for b in p.batches
25+
if b.reference == batchref
26+
), None)
27+
2228

2329
class FakeUnitOfWork(unit_of_work.AbstractUnitOfWork):
2430

0 commit comments

Comments
 (0)