diff options
Diffstat (limited to 'django_openid_auth/tests/test_settings.py')
-rw-r--r-- | django_openid_auth/tests/test_settings.py | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/django_openid_auth/tests/test_settings.py b/django_openid_auth/tests/test_settings.py index 5704ffa..d98eff8 100644 --- a/django_openid_auth/tests/test_settings.py +++ b/django_openid_auth/tests/test_settings.py @@ -1,4 +1,34 @@ -from unittest import skipIf, TestLoader +# django-openid-auth - OpenID integration for django.contrib.auth +# +# Copyright (C) 2013 Canonical Ltd. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from __future__ import unicode_literals + +from unittest import skipIf from django import VERSION from django.conf import settings @@ -16,20 +46,9 @@ class SessionSerializerTest(TestCase): [0] https://bit.ly/1myzetd [1] https://github.com/openid/python-openid/issues/17 """ - @skipIf(VERSION >= (1, 6, 0), "Old versions used the pickle serializer.") - def test_not_using_json_session_serializer(self): - # We use getattr because this setting did not exist in Django - # 1.4 (pickle serialization was hard coded) - serializer = getattr(settings, 'SESSION_SERIALIZER', '') - self.assertNotEqual( - serializer, 'django.contrib.sessions.serializers.JSONSerializer') - @skipIf(VERSION < (1, 6, 0), "Newer versions use JSON by default.") - def test_using_json_session_serializer(self): + @skipIf(VERSION < (1, 5), "Django 1.4 does not provide SESSION_SERIALIZER") + def test_using_pickle_session_serializer(self): serializer = getattr(settings, 'SESSION_SERIALIZER', '') self.assertEqual( - serializer, 'django.contrib.sessions.serializers.JSONSerializer') - - -def suite(): - return TestLoader().loadTestsFromName(__name__) + serializer, 'django.contrib.sessions.serializers.PickleSerializer') |