Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add test for getting authorized amount of a payment

Unknown1718ec4e98d5
diff --git a/tests/test_payment.py b/tests/test_payment.py
index 5fecf485de..672103ee16 100644
--- a/tests/test_payment.py
+++ b/tests/test_payment.py
@@ -565,3 +565,15 @@ def test_can_refund(payment_dummy: Payment):
payment_dummy.charge_status = ChargeStatus.CHARGED
assert payment_dummy.can_refund()
+
+
+def test_payment_get_authorized_amount(payment_txn_preauth):
+ authorized_amount = payment_txn_preauth.transactions.first().amount
+ assert payment_txn_preauth.get_authorized_amount().amount == \
+ authorized_amount
+ assert payment_txn_preauth.order.total_authorized.amount == \
+ authorized_amount
+
+
+ payment_txn_preauth.transactions.all().delete()
+ assert payment_txn_preauth.get_authorized_amount().amount == Decimal(0)