Пример #1
0
 def test_show(self):
     inventory = self.create_inventory()
     inventory.invoice_number = 4123
     item = self.create_inventory_item(inventory, 5)
     item.actual_quantity = 10
     dialog = InventoryAdjustmentEditor(self.store, inventory)
     self.check_editor(dialog, 'dialog-product-adjustment')
    def test_adjust_all(self):
        inventory = self.create_inventory()
        item = self.create_inventory_item(inventory, 5)
        item.counted_quantity = 10

        dialog = InventoryAdjustmentEditor(self.store, inventory)
        dialog.invoice_number.update(123)
        self.assertEquals(item.actual_quantity, None)
        self.click(dialog.adjust_all_button)
        self.assertEquals(item.actual_quantity, 10)
        self.assertEquals(item.reason, 'Automatic adjustment')
Пример #3
0
    def test_adjust(self, run_dialog):
        inventory = self.create_inventory()
        item = self.create_inventory_item(inventory, 5)
        item.actual_quantity = 10

        dialog = InventoryAdjustmentEditor(self.store, inventory)
        self.assertNotSensitive(dialog, ['adjust_button'])

        dialog.invoice_number.update(123)
        dialog.inventory_items.select(item)
        # _run_adjustment_dialog commits the store. Avoid that as it will
        # break other tests
        confirm = 'stoqlib.database.runtime.StoqlibStore.confirm'
        with mock.patch(confirm):
            self.click(dialog.adjust_button)

        self.assertEquals(run_dialog.call_count, 1)