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.
69
69
you run any other Django application test suite. Just type ``python manage.py
70
70
test djangosaml2 ``.
71
71
72
+ Python 2 users need to ``pip install djangosaml2[test] `` in order to run the
73
+ tests.
74
+
72
75
Then you have to add the ``djangosaml2.backends.Saml2Backend ``
73
76
authentication backend to the list of authentications backends.
74
77
By default only the ModelBackend included in Django is configured.
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
16
- import os
17
16
import codecs
17
+ import os
18
+ import sys
18
19
from setuptools import setup , find_packages
19
20
20
21
21
22
def read (* rnames ):
22
23
return codecs .open (os .path .join (os .path .dirname (__file__ ), * rnames ), encoding = 'utf-8' ).read ()
23
24
24
25
26
+ extra = {'test' : []}
27
+ if sys .version_info < (3 , 4 ):
28
+ # Necessary to use assertLogs in tests
29
+ extra ['test' ].append ('unittest2' )
30
+
31
+
25
32
setup (
26
33
name = 'djangosaml2' ,
27
34
version = '0.16.10' ,
@@ -65,4 +72,5 @@ def read(*rnames):
65
72
'pysaml2==4.4.0' ,
66
73
'defusedxml>=0.4.1'
67
74
],
75
+ extras_require = extra ,
68
76
)
Original file line number Diff line number Diff line change 14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
17
+ import sys
18
+
17
19
from django .contrib .auth import get_user_model
18
20
from django .contrib .auth .models import User as DjangoUserModel
19
21
from django .test import TestCase , override_settings
22
24
23
25
User = get_user_model ()
24
26
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
+
25
38
26
39
class Saml2BackendTests (TestCase ):
27
40
def test_update_user (self ):
Original file line number Diff line number Diff line change 16
16
django110: Django>=1.10,<1.11
17
17
django111: Django>=1.11,<2.0
18
18
djangomaster: https://github.com/django/django/archive/master.tar.gz
19
+ .[test]
19
20
20
21
ignore_outcome =
21
22
djangomaster: True
You can’t perform that action at this time.
0 commit comments