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
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
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
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
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
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
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]