aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/test_authentication.py
diff options
context:
space:
mode:
authorMax Peterson2014-04-28 13:10:34 +0100
committerMax Peterson2014-04-28 13:10:34 +0100
commit170fa10ae0f2b531a8011be33cc9417b9f71e698 (patch)
tree371384e1c6a68f9b43d7808b0cf6ba146edc426e /rest_framework/tests/test_authentication.py
parent1c777ffe8b67c342bc1b27fefe67d1094a2f6b07 (diff)
downloaddjango-rest-framework-170fa10ae0f2b531a8011be33cc9417b9f71e698.tar.bz2
Python < 3 compatibility.
Diffstat (limited to 'rest_framework/tests/test_authentication.py')
-rw-r--r--rest_framework/tests/test_authentication.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/rest_framework/tests/test_authentication.py b/rest_framework/tests/test_authentication.py
index 8773f580..34ce1b7a 100644
--- a/rest_framework/tests/test_authentication.py
+++ b/rest_framework/tests/test_authentication.py
@@ -199,7 +199,13 @@ class TokenAuthTests(TestCase):
"""Ensure generate_key returns a string"""
token = Token()
key = token.generate_key()
- self.assertTrue(isinstance(key, str))
+ try:
+ # added in Python < 3
+ base = unicode
+ except NameError:
+ # added in Python >= 3
+ base = str
+ self.assertTrue(isinstance(key, base))
def test_token_login_json(self):
"""Ensure token login view using JSON POST works."""