def test_provider_supports_3ds_redirect(self):
        provider = DummyProvider()
        verification_result = PaymentStatus.CONFIRMED
        data = {
            'status': PaymentStatus.WAITING,
            'fraud_status': FraudStatus.UNKNOWN,
            'gateway_response': '3ds-redirect',
            'verification_result': verification_result
        }
        params = urlencode({'verification_result': verification_result})
        expected_redirect = '%s?%s' % (self.payment.get_process_url(), params)

        with self.assertRaises(RedirectNeeded) as exc:
            provider.get_form(self.payment, data)
            self.assertEqual(exc.args[0], expected_redirect)
    def test_provider_raises_verification_result_needed_on_success(self):
        provider = DummyProvider()
        data = {
            'status': PaymentStatus.WAITING,
            'fraud_status': FraudStatus.UNKNOWN,
            'gateway_response': '3ds-redirect'
        }

        form = provider.get_form(self.payment, data)
        self.assertFalse(form.validate())
 def test_provider_switches_payment_status_on_get_form(self):
     provider = DummyProvider()
     form = provider.get_form(self.payment, data={})
     self.assertEqual(self.payment.status, PaymentStatus.INPUT)