Skip to content

Commit

Permalink
Fix urljoin import for Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Jun 30, 2018
1 parent f2f8624 commit f437fdd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions django_test_mixins.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from django.test import TestCase
from django.core.cache import cache

import urlparse
try:
from urlparse import urljoin # python2
except ImportError:
from urllib.parse import urljoin # python3


class HttpCodeTestCase(TestCase):
Expand Down Expand Up @@ -32,7 +35,7 @@ def assertHttpRedirect(self, response, location=None):
if location.startswith("http://testserver/"):
absolute_location = location
else:
absolute_location = urlparse.urljoin("http://testserver/", location)
absolute_location = urljoin("http://testserver/", location)

self.assertEqual(response['Location'], absolute_location)

Expand Down

0 comments on commit f437fdd

Please sign in to comment.