add support for django 1.11 in tests (#21489)
This commit is contained in:
parent
75e6f1d671
commit
d2edc0b053
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import patterns, url
|
||||
from django.conf.urls import url
|
||||
from django.http import HttpResponse
|
||||
|
||||
from authentic2.decorators import SessionCache, DjangoCache
|
||||
|
@ -24,7 +24,7 @@ def session_cache(request):
|
|||
value = session_cache_function()
|
||||
return HttpResponse('%s' % value)
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = [
|
||||
url(r'^django_cache/$', cached_view),
|
||||
url(r'^session_cache/$', session_cache),
|
||||
)
|
||||
]
|
||||
|
|
|
@ -290,7 +290,6 @@ class UserProfileTests(TestCase):
|
|||
|
||||
|
||||
class CacheTests(TestCase):
|
||||
urls = 'cache_urls'
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def cache_settings(self, settings):
|
||||
|
@ -345,6 +344,7 @@ class CacheTests(TestCase):
|
|||
for a in range(2, 10):
|
||||
self.assertEquals(i(a, a), a)
|
||||
|
||||
@override_settings(ROOT_URLCONF='tests.cache_urls')
|
||||
def test_django_cache(self):
|
||||
response1 = self.client.get('/django_cache/',
|
||||
HTTP_HOST='cache1.example.com')
|
||||
|
@ -355,6 +355,7 @@ class CacheTests(TestCase):
|
|||
self.assertNotEqual(response1.content, response2.content)
|
||||
self.assertEqual(response1.content, response3.content)
|
||||
|
||||
@override_settings(ROOT_URLCONF='tests.cache_urls')
|
||||
def test_session_cache(self):
|
||||
client = Client()
|
||||
response1 = client.get('/session_cache/')
|
||||
|
|
|
@ -10,7 +10,7 @@ from jwcrypto.jwt import JWT
|
|||
|
||||
from httmock import urlmatch, HTTMock
|
||||
|
||||
from django.utils.timezone import UTC
|
||||
from django.utils.timezone import utc
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.utils.timezone import now
|
||||
|
@ -77,8 +77,8 @@ def test_idtoken():
|
|||
assert token.iss == payload_decoded['iss']
|
||||
assert token.aud == payload_decoded['aud']
|
||||
assert token.nonce == payload_decoded['nonce']
|
||||
assert token.iat == datetime.datetime(2011, 7, 21, 20, 42, 50, tzinfo=UTC())
|
||||
assert token.exp == datetime.datetime(2011, 7, 21, 20, 59, 30, tzinfo=UTC())
|
||||
assert token.iat == datetime.datetime(2011, 7, 21, 20, 42, 50, tzinfo=utc)
|
||||
assert token.exp == datetime.datetime(2011, 7, 21, 20, 59, 30, tzinfo=utc)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
Loading…
Reference in New Issue