diff options
| author | Max Peterson | 2014-04-28 13:13:51 +0100 |
|---|---|---|
| committer | Max Peterson | 2014-04-28 13:13:51 +0100 |
| commit | 73597a16a2a6a388a08af923a1da8aa71d2f2848 (patch) | |
| tree | 569f85cd7f618d8d60a1b6eb635d375e49fc6cc6 | |
| parent | 170fa10ae0f2b531a8011be33cc9417b9f71e698 (diff) | |
| download | django-rest-framework-73597a16a2a6a388a08af923a1da8aa71d2f2848.tar.bz2 | |
Better Python < 3 compatibility.
| -rw-r--r-- | rest_framework/tests/test_authentication.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/rest_framework/tests/test_authentication.py b/rest_framework/tests/test_authentication.py index 34ce1b7a..a1c43d9c 100644 --- a/rest_framework/tests/test_authentication.py +++ b/rest_framework/tests/test_authentication.py @@ -19,7 +19,7 @@ from rest_framework.authentication import ( OAuth2Authentication ) from rest_framework.authtoken.models import Token -from rest_framework.compat import patterns, url, include +from rest_framework.compat import patterns, url, include, six from rest_framework.compat import oauth2_provider, oauth2_provider_scope from rest_framework.compat import oauth, oauth_provider from rest_framework.test import APIRequestFactory, APIClient @@ -199,13 +199,7 @@ class TokenAuthTests(TestCase): """Ensure generate_key returns a string""" token = Token() key = token.generate_key() - try: - # added in Python < 3 - base = unicode - except NameError: - # added in Python >= 3 - base = str - self.assertTrue(isinstance(key, base)) + self.assertTrue(isinstance(key, six.string_types)) def test_token_login_json(self): """Ensure token login view using JSON POST works.""" |
