summaryrefslogtreecommitdiffstats
path: root/tests/test_lingo_remote_regie.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_lingo_remote_regie.py')
-rw-r--r--tests/test_lingo_remote_regie.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test_lingo_remote_regie.py b/tests/test_lingo_remote_regie.py
index 6ae7087..b26240d 100644
--- a/tests/test_lingo_remote_regie.py
+++ b/tests/test_lingo_remote_regie.py
@@ -20,7 +20,7 @@ from django.contrib.auth.models import User
from combo.utils import check_query, aes_hex_encrypt
from combo.data.models import Page
from combo.apps.lingo.models import (Regie, ActiveItems, ItemsHistory, SelfDeclaredInvoicePayment,
- Transaction, BasketItem)
+ Transaction, BasketItem, PaymentBackend)
pytestmark = pytest.mark.django_db
@@ -56,6 +56,11 @@ def admin():
@pytest.fixture
def remote_regie():
try:
+ payment_backend = PaymentBackend.objects.get(slug='test1')
+ except PaymentBackend.DoesNotExist:
+ payment_backend = PaymentBackend.objects.create(
+ label='test1', slug='test1', service='dummy', service_options={'siret': '1234'})
+ try:
regie = Regie.objects.get(slug='remote')
except Regie.DoesNotExist:
regie = Regie()
@@ -63,8 +68,7 @@ def remote_regie():
regie.slug = 'remote'
regie.description = 'remote'
regie.payment_min_amount = Decimal(2.0)
- regie.service = 'dummy'
- regie.service_options = {'siret': '1234'}
+ regie.payment_backend = payment_backend
regie.webservice_url = 'http://example.org/regie' # is_remote
regie.save()
return regie
@@ -204,7 +208,8 @@ def test_anonymous_successful_item_payment(mock_get, mock_pay_invoice, app, remo
'ok': True, 'reason': 'Paid'}
# make sure return url is the user return URL
assert urlparse.urlparse(qs['return_url'][0]).path.startswith(
- reverse('lingo-return', kwargs={'regie_pk': remote_regie.id}))
+ reverse('lingo-return-payment-backend',
+ kwargs={'payment_backend_pk': remote_regie.payment_backend.id}))
# simulate successful return URL
resp = app.get(qs['return_url'][0], params=args)
assert resp.status_code == 302
@@ -326,7 +331,8 @@ def test_remote_item_payment_failure(mock_post, mock_get, mock_pay_invoice, app,
'ok': True, 'reason': 'Paid'}
# make sure return url is the user return URL
assert urlparse.urlparse(qs['return_url'][0]).path.startswith(
- reverse('lingo-return', kwargs={'regie_pk': remote_regie.id}))
+ reverse('lingo-return-payment-backend',
+ kwargs={'payment_backend_pk': remote_regie.payment_backend.id}))
# simulate payment failure
mock_get.side_effect = ConnectionError('where is my hostname?')
resp = app.get(qs['return_url'][0], params=args)