mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-10-30 15:37:50 +03:00 
			
		
		
		
	Better Python < 3 compatibility.
This commit is contained in:
		
							parent
							
								
									170fa10ae0
								
							
						
					
					
						commit
						73597a16a2
					
				|  | @ -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.""" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user