Skip to content

Commit 8f67133

Browse files
committed
fake repo get_by_batchref [fakerepo_get_by_batchref]
1 parent 71a6fa3 commit 8f67133

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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 if b.reference == batchref),
25+
None,
26+
)
27+
2228

2329
class FakeUnitOfWork(unit_of_work.AbstractUnitOfWork):
2430
def __init__(self):

0 commit comments

Comments
 (0)