Skip to content
This repository was archived by the owner on May 26, 2020. It is now read-only.

Commit bd3f189

Browse files
committed
Skip custom user test if version is less than 1.5
1 parent 3e55ec6 commit bd3f189

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/test_views.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import time
12
from calendar import timegm
23
from datetime import datetime, timedelta
3-
import time
44

5+
from django import get_version
56
from django.test import TestCase
67
from django.test.utils import override_settings
8+
from django.utils import unittest
79
from django.contrib.auth.models import User
810
from django.conf.urls import patterns
911

@@ -15,6 +17,9 @@
1517

1618
from .models import CustomUser
1719

20+
21+
NO_CUSTOM_USER_MODEL = 'Custom User Model only supported after Django 1.5'
22+
1823
urlpatterns = patterns(
1924
'',
2025
(r'^auth-token/$', 'rest_framework_jwt.views.obtain_jwt_token'),
@@ -111,6 +116,7 @@ def test_jwt_login_with_expired_token(self):
111116
self.assertEqual(decoded_payload['username'], self.username)
112117

113118

119+
@unittest.skipIf(get_version() < '1.5.0', 'No Configurable User model feature')
114120
@override_settings(AUTH_USER_MODEL='tests.CustomUser')
115121
class CustomUserObtainJSONWebTokenTests(TestCase):
116122
"""JSON Web Token Authentication"""
@@ -248,5 +254,4 @@ def test_refresh_jwt_after_refresh_expiration(self):
248254

249255
def tearDown(self):
250256
# 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

Comments
 (0)