def test_get_payment_method_source_type(self): """ Source Type name should be displayed as the Payment method when the credit card wasn't used to purchase a product. """ order = self.create_order() source = factories.SourceFactory(order=order) payment_method = ReceiptResponseView().get_payment_method(order) self.assertEqual(payment_method, source.source_type.name)
def test_get_payment_method_credit_card_purchase(self): """ Credit card type and Source label should be displayed as the Payment method when a Credit card was used to purchase a product. """ order = self.create_order() source = factories.SourceFactory(order=order, card_type='Dummy Card', label='Test') payment_method = ReceiptResponseView().get_payment_method(order) self.assertEqual(payment_method, '{} {}'.format(source.card_type, source.label))