def test_confirm(self): editor = OutPaymentEditor(self.store) self.assertFalse(editor.validate_confirm()) editor.description.update('Payment name') self.assertFalse(editor.validate_confirm()) editor.value.update(100) self.assertFalse(editor.validate_confirm()) editor.due_date.update(localdate(2015, 1, 1).date()) self.assertTrue(editor.validate_confirm()) editor.repeat.update(INTERVALTYPE_WEEK) self.assertFalse(editor.validate_confirm()) editor.end_date.update(localdate(2014, 1, 10).date()) self.assertFalse(editor.validate_confirm()) editor.end_date.update(localdate(2015, 1, 10).date()) self.assertTrue(editor.validate_confirm()) editor.main_dialog.confirm() model = editor.retval self.check_editor(editor, 'editor-payment-confirm', [model.group] + list(model.group.payments))
def test_edit_paid_out_payment(self): payment = self.create_payment() payment.status = Payment.STATUS_PENDING account = self.store.find(Account, description=u'Income').one() payment.pay(account=account) editor = OutPaymentEditor(self.store, payment) self.check_editor(editor, 'editor-paid-out-payment-edit')
def test_show_lonely_dialog_out(self, run_dialog): payment = self.create_payment(payment_type=Payment.TYPE_OUT) payment.group = self.create_payment_group() editor = OutPaymentEditor(self.store, payment) self.click(editor.details_button) run_dialog.assert_called_once_with(LonelyPaymentDetailsDialog, editor, editor.store, editor.model)
def test_show_from_purchase(self): purchase = self.create_purchase_order() purchase.identifier = 12345 self.add_payments(purchase, method_type=u'money') p = purchase.payments[0] editor = OutPaymentEditor(self.store, p) self.check_editor(editor, 'editor-out-payment-show-purchase')
def test_show_purchase_dialog(self, run_dialog): purchase = self.create_purchase_order() self.add_payments(purchase, method_type=u'money') p = purchase.payments[0] editor = OutPaymentEditor(self.store, p) self.click(editor.details_button) run_dialog.assert_called_once_with(PurchaseDetailsDialog, editor, editor.store, purchase)
def test_create_for_another_branch(self, current_branch): branch = self.create_branch() with self.sysparam(SYNCHRONIZED_MODE=True): editor = OutPaymentEditor(self.store) current_branch.return_value = branch editor.description.update('Payment name') editor.value.update(100) editor.due_date.update(localdate(2015, 1, 1).date()) editor.repeat.update(INTERVALTYPE_MONTH) editor.end_date.update(localdate(2016, 1, 10).date()) editor.main_dialog.confirm() self.assertEquals(editor.model.identifier, -1)
def test_show_out(self): payment = self.create_payment(payment_type=Payment.TYPE_OUT) payment.group = self.create_payment_group() editor = OutPaymentEditor(self.store, payment) self.check_editor(editor, 'editor-out-payment-show')