File tree Expand file tree Collapse file tree 4 files changed +26
-1
lines changed
Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ do to make sure it is compatible with your Django version and environment.
6969 you run any other Django application test suite. Just type ``python manage.py
7070 test djangosaml2 ``.
7171
72+ Python 2 users need to ``pip install djangosaml2[test] `` in order to run the
73+ tests.
74+
7275Then you have to add the ``djangosaml2.backends.Saml2Backend ``
7376authentication backend to the list of authentications backends.
7477By default only the ModelBackend included in Django is configured.
Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515
16- import os
1716import codecs
17+ import os
18+ import sys
1819from setuptools import setup , find_packages
1920
2021
2122def read (* rnames ):
2223 return codecs .open (os .path .join (os .path .dirname (__file__ ), * rnames ), encoding = 'utf-8' ).read ()
2324
2425
26+ extra = {'test' : []}
27+ if sys .version_info < (3 , 4 ):
28+ # Necessary to use assertLogs in tests
29+ extra ['test' ].append ('unittest2' )
30+
31+
2532setup (
2633 name = 'djangosaml2' ,
2734 version = '0.16.10' ,
@@ -65,4 +72,5 @@ def read(*rnames):
6572 'pysaml2==4.4.0' ,
6673 'defusedxml>=0.4.1'
6774 ],
75+ extras_require = extra ,
6876 )
Original file line number Diff line number Diff line change 1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17+ import sys
18+
1719from django .contrib .auth import get_user_model
1820from django .contrib .auth .models import User as DjangoUserModel
1921from django .test import TestCase , override_settings
2224
2325User = get_user_model ()
2426
27+ if sys .version_info < (3 , 4 ):
28+ # Monkey-patch TestCase to add the assertLogs method introduced in
29+ # Python 3.4
30+ from unittest2 .case import _AssertLogsContext
31+
32+ class LoggerTestCase (TestCase ):
33+ def assertLogs (self , logger = None , level = None ):
34+ return _AssertLogsContext (self , logger , level )
35+
36+ TestCase = LoggerTestCase
37+
2538
2639class Saml2BackendTests (TestCase ):
2740 def test_update_user (self ):
Original file line number Diff line number Diff line change 1616 django110: Django>=1.10,<1.11
1717 django111: Django>=1.11,<2.0
1818 djangomaster: https://github.com/django/django/archive/master.tar.gz
19+ .[test]
1920
2021ignore_outcome =
2122 djangomaster: True
You can’t perform that action at this time.
0 commit comments