forked from DGNum/gestioCOF
bda.tests -- Use urllib urlencode
This commit is contained in:
parent
3eb939928f
commit
6858df02be
1 changed files with 6 additions and 2 deletions
|
@ -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 "/"
|
||||
|
||||
|
|
Loading…
Reference in a new issue