def testGetSelectedPaymentMethod_1(self): """Customer has selected prepayment by default. """ pm = IPaymentInformationManagement(self.customer) result = pm.getSelectedPaymentMethod().getId() self.assertEqual(result, "prepayment")
def testGetPaymentInformations(self): """Get all payment methods (without parameter) """ pm = IPaymentInformationManagement(self.customer) ids = [p.getId() for p in pm.getPaymentInformations()] self.assertEqual(["bank-account"], ids)
def testGetSelectedPaymentMethod_2(self): """Customer has selected paypal. """ self.customer.selected_payment_method = "paypal" pm = IPaymentInformationManagement(self.customer) result = pm.getSelectedPaymentMethod().getId() self.assertEqual(result, "paypal")
def testGetSelectedPaymentMethod_3(self): """Customer has selected a non existing. Returns default, which is prepayment atm. """ self.customer.selected_payment_method = "dummy" pm = IPaymentInformationManagement(self.customer) result = pm.getSelectedPaymentMethod().getId() self.assertEqual(result, "prepayment")
def testDeletePaymentInformations(self): """ """ pm = IPaymentInformationManagement(self.customer) ids = [p.getId() for p in pm.getPaymentInformations()] self.assertEqual(["bank-account"], ids) # Shop level payment methods shouldn't be deletable here. result = pm.deletePaymentInformation("paypal") self.assertEqual(result, False) result = pm.deletePaymentInformation("prepayment") self.assertEqual(result, False) # still all there? ids = [p.getId() for p in pm.getPaymentInformations()] self.assertEqual(["bank-account"], ids) result = pm.deletePaymentInformation("bank-account") self.assertEqual(result, True) ids = [p.getId() for p in pm.getPaymentInformations()] self.assertEqual([], ids)
def testGetSelectedPaymentInformation(self): """ """ pm = IPaymentInformationManagement(self.customer) result = pm.getSelectedPaymentInformation() self.failUnless(result is None)