def test_confirm_underpaid(self): purchase = self.create_purchase_order() purchase.status = PurchaseOrder.ORDER_CONFIRMED purchase.add_item(self.create_sellable(description=u'Prod 1'), 1) purchase.add_item(self.create_sellable(description=u'Prod 2'), 5) for item in list(purchase.get_items()): item.quantity_received = 1 self.add_payments(purchase) purchase.payments[0].description = u'purchase payment description' purchase.payments[0].due_date = datetime.date.today() purchase.payments[0].identifier = 33333 wizard = PurchaseFinishWizard(self.store, purchase) step = wizard.get_current_step() step.product_list.sort_by_attribute('description') self.check_wizard(wizard, 'wizard-purchase-finish-product-list-step-underpaid') self.click(wizard.next_button) self.check_wizard(wizard, 'wizard-purchase-finish-payment-adjust-step-underpaid') self.click(wizard.next_button) step = wizard.get_current_step() step.slave.payment_list.payment_list[0].description = u'finish description' self.click(wizard.next_button) self.check_wizard(wizard, 'wizard-purchase-finish-payment-step-underpaid', [wizard.purchase.group, wizard.purchase] + list(wizard.retval))
def test_confirm_overpaid(self): purchase = self.create_purchase_order() purchase.add_item(self.create_sellable(description=u'Prod 1'), 1) purchase.add_item(self.create_sellable(description=u'Prod 2'), 5) purchase.status = PurchaseOrder.ORDER_CONFIRMED wizard = PurchaseFinishWizard(self.store, purchase) step = wizard.get_current_step() step.product_list.sort_by_attribute('description') self.check_wizard(wizard, 'wizard-purchase-finish-product-list-step-overpaid') self.click(wizard.next_button) self.click(wizard.next_button) wizard.retval.description = u'description' self.check_wizard(wizard, 'wizard-purchase-finish-payment-adjust-step-overpaid', [wizard.purchase.group, wizard.retval, wizard.purchase] + list(wizard.purchase.get_items()))