Private
Public Access
1
0

more payment view coverage tests

This commit is contained in:
Sander Roosendaal
2021-04-25 17:41:04 +02:00
parent e19158926d
commit df86eaac0c
11 changed files with 448 additions and 169 deletions

View File

@@ -15,7 +15,7 @@ def braintree_webhook_view(request):
f.write(timestamp+' /rowers/braintree/\n')
if request.method == 'POST':
result = braintreestuff.webhook(request)
if result == 4:
if result == 4: # pragma: no cover
raise PermissionDenied("Not allowed")
return HttpResponse('')
@@ -23,7 +23,7 @@ def braintree_webhook_view(request):
def paidplans_view(request):
if not request.user.is_anonymous:
r = request.user.rower
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring':
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
else:
r = None
@@ -36,7 +36,7 @@ def paidplans_view(request):
@login_required()
def billing_view(request):
if not PAYMENT_PROCESSING_ON:
if not PAYMENT_PROCESSING_ON: # pragma: no cover
url = reverse('promembership')
return HttpResponseRedirect(url)
@@ -45,7 +45,7 @@ def billing_view(request):
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring':
messages.error(request,'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
if payments.is_existing_customer(r):
if payments.is_existing_customer(r): # pragma: no cover
url = reverse(upgrade_view)
return HttpResponseRedirect(url)
@@ -63,7 +63,7 @@ def billing_view(request):
plan = planselectform.cleaned_data['plan']
try:
customer_id = braintreestuff.create_customer(r)
except ProcessorCustomerError:
except ProcessorCustomerError: # pragma: no cover
messages.error(request,"Something went wrong registering you as a customer.")
url = reverse(billing_view)
return HttpResponseRedirect(url)