Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #5
0
 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
Beispiel #6
0
 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
Beispiel #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]