|
| 1 | +import time |
1 | 2 | from calendar import timegm
|
2 | 3 | from datetime import datetime, timedelta
|
3 |
| -import time |
4 | 4 |
|
| 5 | +from django import get_version |
5 | 6 | from django.test import TestCase
|
6 | 7 | from django.test.utils import override_settings
|
| 8 | +from django.utils import unittest |
7 | 9 | from django.contrib.auth.models import User
|
8 | 10 | from django.conf.urls import patterns
|
9 | 11 |
|
|
15 | 17 |
|
16 | 18 | from .models import CustomUser
|
17 | 19 |
|
| 20 | + |
| 21 | +NO_CUSTOM_USER_MODEL = 'Custom User Model only supported after Django 1.5' |
| 22 | + |
18 | 23 | urlpatterns = patterns(
|
19 | 24 | '',
|
20 | 25 | (r'^auth-token/$', 'rest_framework_jwt.views.obtain_jwt_token'),
|
@@ -111,6 +116,7 @@ def test_jwt_login_with_expired_token(self):
|
111 | 116 | self.assertEqual(decoded_payload['username'], self.username)
|
112 | 117 |
|
113 | 118 |
|
| 119 | +@unittest.skipIf(get_version() < '1.5.0', 'No Configurable User model feature') |
114 | 120 | @override_settings(AUTH_USER_MODEL='tests.CustomUser')
|
115 | 121 | class CustomUserObtainJSONWebTokenTests(TestCase):
|
116 | 122 | """JSON Web Token Authentication"""
|
@@ -248,5 +254,4 @@ def test_refresh_jwt_after_refresh_expiration(self):
|
248 | 254 |
|
249 | 255 | def tearDown(self):
|
250 | 256 | # Restore original settings
|
251 |
| - api_settings.JWT_ALLOW_REFRESH = \ |
252 |
| - DEFAULTS['JWT_ALLOW_REFRESH'] |
| 257 | + api_settings.JWT_ALLOW_REFRESH = DEFAULTS['JWT_ALLOW_REFRESH'] |
0 commit comments