Used urllib.parse.urljoin() in auth_tests to join URLs.

As the strings represent URLs and not paths, should use urllib to
manipulate them.
This commit is contained in:
Jon Dufresne 2020-07-09 03:03:03 -07:00 committed by GitHub
parent 8a6df55f2d
commit 5a3d7cf462
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -1,10 +1,9 @@
import datetime import datetime
import itertools import itertools
import os
import re import re
from importlib import import_module from importlib import import_module
from unittest import mock from unittest import mock
from urllib.parse import quote from urllib.parse import quote, urljoin
from django.apps import apps from django.apps import apps
from django.conf import settings from django.conf import settings
@ -1216,10 +1215,7 @@ class ChangelistTests(AuthViewsTestCase):
r'you can change the password using <a href="([^"]*)">this form</a>', r'you can change the password using <a href="([^"]*)">this form</a>',
response.content.decode() response.content.decode()
)[1] )[1]
self.assertEqual( self.assertEqual(urljoin(user_change_url, rel_link), password_change_url)
os.path.normpath(user_change_url + rel_link),
os.path.normpath(password_change_url)
)
response = self.client.post( response = self.client.post(
password_change_url, password_change_url,