コード例 #1
0
    def test_delete_model(self):
        InvoiceLayout(store=self.store, description=u"Standard Invoice",
                      width=500, height=500)

        dialog = InvoiceLayoutDialog(store=self.store, reuse_store=True)

        item = dialog.list_slave.listcontainer.list[0]
        dialog.list_slave.listcontainer.list.select(item)

        with mock.patch('kiwi.ui.listdialog.yesno') as yesno:
            yesno.side_effect = lambda *x, **y: Gtk.ResponseType.OK
            self.click(dialog.list_slave.listcontainer.remove_button)

            yesno.assert_called_with('Do you want to remove Standard Invoice ?',
                                     buttons=(
                                         ('gtk-cancel', Gtk.ResponseType.CANCEL),
                                         ('gtk-remove', Gtk.ResponseType.OK)),
                                     default=Gtk.ResponseType.OK, parent=None)
コード例 #2
0
ファイル: test_sales.py プロジェクト: prohealthbox/stoq
    def test_print_invoice(self, info, print_sale_invoice, run_dialog,
                           new_store):
        new_store.return_value = self.store

        app = self.create_app(SalesApp, u'sales')
        results = app.results
        results.select(results[0])

        self.activate(app.SalesPrintInvoice)
        info.assert_called_once_with(
            u"There are no invoice printer configured "
            u"for this station")

        layout = InvoiceLayout(description=u'layout',
                               width=10,
                               height=20,
                               store=self.store)
        printer = InvoicePrinter(store=self.store,
                                 description=u'test invoice',
                                 layout=layout,
                                 device_name=u'/dev/lp0',
                                 station=api.get_current_station(self.store))
        self.activate(app.SalesPrintInvoice)
        self.assertEquals(print_sale_invoice.call_count, 1)
        args, kwargs = print_sale_invoice.call_args
        invoice, called_printer = args
        self.assertTrue(isinstance(invoice, SaleInvoice))
        self.assertEquals(printer, called_printer)

        results[0].sale.invoice.invoice_number = None
        InvoiceField(layout=layout,
                     x=0,
                     y=0,
                     width=1,
                     height=1,
                     field_name=u'INVOICE_NUMBER',
                     store=self.store)
        with mock.patch.object(self.store, 'commit'):
            with mock.patch.object(self.store, 'close'):
                self.activate(app.SalesPrintInvoice)
                run_dialog.assert_called_once_with(SaleInvoicePrinterDialog,
                                                   self.store, results[0].sale,
                                                   printer)
コード例 #3
0
ファイル: invoiceeditor.py プロジェクト: sarkis89/stoq
 def create_model(self, store):
     return InvoiceLayout(description=u'Untitled',
                          width=80,
                          height=40,
                          store=store)
コード例 #4
0
    def test_show(self):
        InvoiceLayout(description=u'Test Invoice', width=500, height=500)

        dialog = InvoiceLayoutDialog(store=self.store)
        self.check_dialog(dialog, 'invoice-layout-dialog-show')
コード例 #5
0
ファイル: test_invoice.py プロジェクト: rosalin/stoq
 def create_layout(self):
     return InvoiceLayout(description=u'layout',
                          width=10,
                          height=20,
                          store=self.store)