Ejemplo n.º 1
0
    def test_is_successful(self):
        card = Card()
        card.status = "processed"
        payment1 = Payment()
        payment1.card = card

        bank = Bank()
        bank.status = "processed"
        payment2 = Payment()
        payment2.bank = bank

        self.assertTrue(payment1.is_successful())
        self.assertTrue(payment2.is_successful())
Ejemplo n.º 2
0
    def test_is_successful_errored(self):
        card = Card()
        card.status = "errored"
        payment = Payment()
        payment.card = card

        self.assertFalse(payment.is_successful())
Ejemplo n.º 3
0
    def test_is_successful_declined(self):
        card = Card()
        card.status = "declined"
        payment = Payment(source='card')
        payment.card = card

        self.assertFalse(payment.is_successful())
Ejemplo n.º 4
0
    def test_bank_is_successful(self):
        bank = Bank()
        payment = Payment()
        payment.source = "bank"
        payment.bank = bank

        self.assertTrue(payment.is_successful())
Ejemplo n.º 5
0
    def test_is_successful(self):
        card = Card()
        card.status = "processed"
        payment = Payment(source='card')
        payment.card = card

        self.assertTrue(payment.is_successful())
    def test_is_successful(self):
        bank = Bank()
        bank.status = "processed"
        payment = Payment()
        payment.source = "bank"
        payment.bank = bank

        self.assertTrue(payment.is_successful())
Ejemplo n.º 7
0
 def test_is_successful_bank_payment(self):
     data = {
         "amount": "2000",
         "bank_account_id": "12345",
         "customer_id": "123",
         "date": "2019-02-01"
     }
     payment = Payment("bank", data)
     self.assertTrue(payment.is_successful())
Ejemplo n.º 8
0
    def test_is_successful(self):

        data = {
            "amount": "2000",
            "card_id": "45",
            "card_status": "processed",
            "customer_id": "123",
            "date": "2019-02-01",
        }
        payment = Payment("card", data)
        self.assertTrue(payment.is_successful())
Ejemplo n.º 9
0
def create_stub_payment(mock_is_successful):
    payment = Payment()
    payment.is_successful = lambda: mock_is_successful
    return payment
Ejemplo n.º 10
0
    def test_no_source_is_not_successful(self):
        card = Card()
        payment = Payment()
        payment.card = card

        self.assertFalse(payment.is_successful())
Ejemplo n.º 11
0
 def test_bank_is_successful(self):
     bank_account = BankAccount()
     payment = Payment()
     payment.bank_account = bank_account
     self.assertTrue(payment.is_successful())