Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix tests for dummy gateway with improved gateway validation
Unknown2c530397715f
diff --git a/tests/gateway/test_dummy.py b/tests/gateway/test_dummy.pyindex 96ce0acf05..27cd37b8bc 100644--- a/tests/gateway/test_dummy.py+++ b/tests/gateway/test_dummy.py@@ -46,16 +46,16 @@ def test_authorize_gateway_error(payment_dummy, monkeypatch):assert txn.payment == payment_dummy-def test_void_success(payment_dummy):- assert payment_dummy.is_active- assert payment_dummy.charge_status == ChargeStatus.NOT_CHARGED- txn = payment_dummy.void()+def test_void_success(payment_txn_preauth):+ assert payment_txn_preauth.is_active+ assert payment_txn_preauth.charge_status == ChargeStatus.NOT_CHARGED+ txn = payment_txn_preauth.void()assert txn.is_successassert txn.kind == TransactionKind.VOID- assert txn.payment == payment_dummy- payment_dummy.refresh_from_db()- assert not payment_dummy.is_active- assert payment_dummy.charge_status == ChargeStatus.NOT_CHARGED+ assert txn.payment == payment_txn_preauth+ payment_txn_preauth.refresh_from_db()+ assert not payment_txn_preauth.is_active+ assert payment_txn_preauth.charge_status == ChargeStatus.NOT_CHARGED@pytest.mark.parametrize(@@ -74,24 +74,24 @@ def test_void_failed(is_active, charge_status, payment_dummy):assert txn is None-def test_void_gateway_error(payment_dummy, monkeypatch):+def test_void_gateway_error(payment_txn_preauth, monkeypatch):monkeypatch.setattr('saleor.payment.gateways.dummy.dummy_success', lambda: False)with pytest.raises(PaymentError):- txn = payment_dummy.void()+ txn = payment_txn_preauth.void()assert txn.kind == TransactionKind.VOIDassert not txn.is_success- assert txn.payment == payment_dummy+ assert txn.payment == payment_txn_preauth@pytest.mark.parametrize('amount', [80, 70])-def test_capture_success(amount, payment_dummy):- txn = payment_dummy.capture(amount=amount)+def test_capture_success(amount, payment_txn_preauth):+ txn = payment_txn_preauth.capture(amount=amount)assert txn.is_success- assert txn.payment == payment_dummy- payment_dummy.refresh_from_db()- assert payment_dummy.charge_status == ChargeStatus.CHARGED- assert payment_dummy.is_active+ assert txn.payment == payment_txn_preauth+ payment_txn_preauth.refresh_from_db()+ assert payment_txn_preauth.charge_status == ChargeStatus.CHARGED+ assert payment_txn_preauth.is_active@pytest.mark.parametrize(@@ -113,14 +113,14 @@ def test_capture_failed(assert txn is None-def test_capture_gateway_error(payment_dummy, monkeypatch):+def test_capture_gateway_error(payment_txn_preauth, monkeypatch):monkeypatch.setattr('saleor.payment.gateways.dummy.dummy_success', lambda: False)with pytest.raises(PaymentError):- txn = payment_dummy.capture(80)+ txn = payment_txn_preauth.capture(80)assert txn.kind == TransactionKind.CHARGEassert not txn.is_success- assert txn.payment == payment_dummy+ assert txn.payment == payment_txn_preauth@pytest.mark.parametrize(