aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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."""