def test_show(self): storable = self.create_storable() storable.product.sellable.cost = 15 storable.product.sellable.code = u'100' storable.product.sellable.barcode = u'0000000' storable.product.sellable.description = u'desc' dialog = InitialStockDialog(self.store) self.check_dialog(dialog, 'initial-stock-dialog-show')
def test_cancel(self, yesno): self.create_storable() dialog = InitialStockDialog(self.store) self.click(dialog.main_dialog.cancel_button) yesno.assert_called_once_with(_('Save data before close the dialog ?'), gtk.RESPONSE_NO, _('Save data'), _("Don't save"))
def test_cancel(self, yesno): self.create_storable() with self.sysparam(SYNCHRONIZED_MODE=True): dialog = InitialStockDialog(self.store) dialog.storables[0].initial_stock = 4 self.click(dialog.main_dialog.cancel_button) msg = 'If you cancel this dialog all changes will be lost. Are you sure?' yesno.assert_called_once_with(msg, Gtk.ResponseType.NO, 'Cancel', "Don't cancel")
def test_edit(self): self.create_storable() self.create_storable() dialog = InitialStockDialog(self.store) treeview = dialog.slave.listcontainer.list.get_treeview() treeview.set_cursor(0) rows, column = treeview.get_cursor() item = dialog.slave.listcontainer.list[0] dialog.slave.listcontainer.list.emit('cell-edited', item, 'initial_stock') self.assertNotEquals((rows, column), treeview.get_cursor())
def test_save(self): storable = self.create_storable() storable.product.sellable.cost = 17 storable.product.sellable.code = u'100' storable.product.sellable.barcode = u'0000000' storable.product.sellable.description = u'desc' branch = api.get_current_branch(self.store) stock_item = storable.get_stock_item(branch, None) self.assertEquals(stock_item, None) dialog = InitialStockDialog(self.store) dialog.storables[0].initial_stock = 123 self.click(dialog.main_dialog.ok_button) self.assertEquals(123, storable.get_balance_for_branch(branch)) stock_item = storable.get_stock_item(branch, None) self.assertEquals(stock_item.stock_cost, 17)
def test_format_qty(self): dialog = InitialStockDialog(self.store) self.assertEquals(dialog._format_qty(10), 10) self.assertEquals(dialog._format_qty(ValueUnset), None)
def test_format_qty(self): dialog = InitialStockDialog(self.store) self.assertEquals(dialog._format_qty(10), 10) self.assertEquals(dialog._format_qty(ValueUnset), None)