bda.tests -- Use urllib urlencode

This commit is contained in:
Aurélien Delobelle 2018-09-30 13:22:22 +02:00
parent 3eb939928f
commit 6858df02be

View file

@ -2,9 +2,9 @@ import json
from datetime import timedelta
from unittest import mock
from urllib.parse import urlencode
from django.contrib.auth.models import User
from django.template.defaultfilters import urlencode
from django.test import TestCase, Client
from django.utils import timezone
@ -61,7 +61,11 @@ class BdATestHelpers:
return redirect_url
elif user is None:
# client is not logged in
return "/login?next={}".format(urlencode(urlencode(url)))
login_url = "/login"
if url:
login_url += "?{}".format(urlencode({"next": url},
safe="/"))
return login_url
else:
return "/"