Beispiel #1
0
    def test___str__(self):
        charge = Charge(
            amount=50,
            currency="usd",
            id="ch_test",
            status=ChargeStatus.failed,
            captured=False,
            paid=False,
        )
        self.assertEqual(str(charge), "$50.00 USD (Uncaptured)")

        charge.captured = True
        self.assertEqual(str(charge), "$50.00 USD (Failed)")
        charge.status = ChargeStatus.succeeded

        charge.disputed = True
        self.assertEqual(str(charge), "$50.00 USD (Disputed)")

        charge.disputed = False
        charge.refunded = True
        charge.amount_refunded = 50
        self.assertEqual(str(charge), "$50.00 USD (Refunded)")

        charge.refunded = False
        charge.amount_refunded = 0
        self.assertEqual(str(charge), "$50.00 USD (Succeeded)")

        charge.status = ChargeStatus.pending
        self.assertEqual(str(charge), "$50.00 USD (Pending)")
Beispiel #2
0
	def test_str(self):
		charge = Charge(
			amount=50,
			currency="usd",
			id="ch_test",
			status=ChargeStatus.failed,
			captured=False,
			paid=False,
		)
		self.assertEqual(str(charge), "$50.00 USD (Uncaptured)")

		charge.captured = True
		self.assertEqual(str(charge), "$50.00 USD (Failed)")
		charge.status = ChargeStatus.succeeded

		charge.dispute = Dispute()
		self.assertEqual(str(charge), "$50.00 USD (Disputed)")

		charge.dispute = None
		charge.refunded = True
		charge.amount_refunded = 50
		self.assertEqual(str(charge), "$50.00 USD (Refunded)")

		charge.refunded = False
		self.assertEqual(str(charge), "$50.00 USD (Partially refunded)")

		charge.amount_refunded = 0
		self.assertEqual(str(charge), "$50.00 USD")
Beispiel #3
0
    def test_str(self):
        charge = Charge(
            amount=50,
            currency="usd",
            stripe_id="ch_test",
            status=ChargeStatus.failed,
            captured=False,
            paid=False,
        )
        self.assertEqual(str(charge), "$50.00 USD (Uncaptured)")

        charge.captured = True
        self.assertEqual(str(charge), "$50.00 USD (Failed)")
        charge.status = ChargeStatus.succeeded

        charge.dispute = Dispute()
        self.assertEqual(str(charge), "$50.00 USD (Disputed)")

        charge.dispute = None
        charge.refunded = True
        charge.amount_refunded = 50
        self.assertEqual(str(charge), "$50.00 USD (Refunded)")

        charge.refunded = False
        self.assertEqual(str(charge), "$50.00 USD (Partially refunded)")

        charge.amount_refunded = 0
        self.assertEqual(str(charge), "$50.00 USD")