Beispiel #1
0
    def test_is_successful_errored(self):
        card = Card()
        card.status = "errored"
        card_payment = CardPayment()
        card_payment.card = card

        self.assertFalse(card_payment.is_successful())
Beispiel #2
0
    def test_is_successful(self):
        card = Card()
        card.status = "processed"
        card_payment = CardPayment()
        card_payment.card = card

        self.assertTrue(card_payment.is_successful())
Beispiel #3
0
 def get_payments(self, csv_path, source):
     payments = []
     with open(csv_path) as f:
         reader = csv.DictReader(f)
         for row in reader:
             if source == 'card':
                 payments.append(CardPayment(row))
             if source == 'bank':
                 payments.append(BankPayment(row))
     return payments
Beispiel #4
0
    def test_init_with_data(self):
        data = {
            "amount": "2000",
            "card_id": "45",
            "card_status": "processed",
            "customer_id": "123",
            "date": "2019-02-01",
        }

        card_payment = CardPayment(data)
        card = card_payment.card

        self.assertIsInstance(card, Card)
        self.assertEqual(card.card_id, 45)
        self.assertEqual(card_payment.amount, 1960)
        self.assertEqual(card.status, "processed")
def create_stub_card_payment(mock_is_successful):
    payment = CardPayment()
    payment.is_successful = lambda: mock_is_successful
    return payment
Beispiel #6
0
    def test_init(self):
        card_payment = CardPayment()

        self.assertIsNone(card_payment.card)