コード例 #1
0
 def test_for_new_product(self):
     bus = bootstrap_test_app()
     bus.handle(commands.CreateBatch("b1", "CRUNCHY-ARMCHAIR", 100, None))
     assert bus.uow.products.get("CRUNCHY-ARMCHAIR") is not None
     assert bus.uow.committed
コード例 #2
0
 def test_commits(self):
     bus = bootstrap_test_app()
     bus.handle(commands.CreateBatch("b1", "OMINOUS-MIRROR", 100, None))
     bus.handle(commands.Allocate("o1", "OMINOUS-MIRROR", 10))
     assert bus.uow.committed
コード例 #3
0
 def test_commits(self):
     uow = FakeUnitOfWork()
     messagebus.handle(
         commands.CreateBatch("b1", "OMINOUS-MIRROR", 100, None), uow)
     messagebus.handle(commands.Allocate("o1", "OMINOUS-MIRROR", 10), uow)
     assert uow.committed
コード例 #4
0
 def test_for_new_product(self):
     uow = FakeUnitOfWork()
     messagebus.handle(
         commands.CreateBatch("b1", "CRUNCHY-ARMCHAIR", 100, None), uow)
     assert uow.products.get("CRUNCHY-ARMCHAIR") is not None
     assert uow.committed
コード例 #5
0
ファイル: test_handler.py プロジェクト: LiGuoV/Allocate
 def test_add_batch_for_new_product(self):
     bus = bootstrap_test_app()
     bus.handle(commands.CreateBatch('b1', '黑桌子', 20, None))
     assert bus.uow.products.get('黑桌子') is not None
     assert bus.uow.commited
コード例 #6
0
ファイル: test_handlers.py プロジェクト: mchoplin/code
 def test_allocates(self):
     bus = bootstrap_test_app()
     bus.handle(commands.CreateBatch("b1", "COMPLICATED-LAMP", 100, None))
     bus.handle(commands.Allocate("o1", "COMPLICATED-LAMP", 10))
     [batch] = bus.uow.products.get("COMPLICATED-LAMP").batches
     assert batch.available_quantity == 90
コード例 #7
0
 def test_for_existing_product(self):
     uow = FakeUnitOfWork()
     messagebus.handle(commands.CreateBatch("b1", "GARISH-RUG", 100, None), uow)
     messagebus.handle(commands.CreateBatch("b2", "GARISH-RUG", 99, None), uow)
     assert "b2" in [b.reference for b in uow.products.get("GARISH-RUG").batches]