|
35 | 35 | from djangosaml2.cache import OutstandingQueriesCache |
36 | 36 | from djangosaml2.conf import get_config |
37 | 37 | from djangosaml2.middleware import SamlSessionMiddleware |
38 | | -from djangosaml2.signals import post_authenticated, pre_user_save |
39 | 38 | from djangosaml2.tests import conf |
40 | 39 | from djangosaml2.utils import (get_custom_setting, |
41 | 40 | get_idp_sso_supported_bindings, |
@@ -599,52 +598,6 @@ def _test_metadata(self): |
599 | 598 | self.assertEqual(response.status_code, 200) |
600 | 599 | self.assertEqual(response.content, expected_metadata) |
601 | 600 |
|
602 | | - def test_post_authenticated_signal(self): |
603 | | - self.called = [] |
604 | | - |
605 | | - def signal_handler(sender, instance, session_info, request, **kwargs): |
606 | | - self.called.append({'sender': sender, 'instance': instance, 'request': request, 'session_info': session_info}) |
607 | | - |
608 | | - post_authenticated.connect(signal_handler, dispatch_uid='test_signal') |
609 | | - |
610 | | - self.do_login() |
611 | | - |
612 | | - # make sure the handler is only called once |
613 | | - self.assertEqual(len(self.called), 1) |
614 | | - # test 'sender', this should be User.__class__ |
615 | | - self.assertEqual(self.called[0]['sender'], get_user_model(), 'post_authenticated signal sender is not a User') |
616 | | - # test 'instance', this should be User |
617 | | - self.assertIsInstance(self.called[0]['instance'], get_user_model(), 'post_authenticated signal did not send a User instance') |
618 | | - # test the request |
619 | | - self.assertIsInstance(self.called[0]['request'], HttpRequest, 'post_authenticated signal did not send a request') |
620 | | - # test the session_info |
621 | | - self.assertIsInstance(self.called[0]['session_info'], dict, 'post_authenticated signal did not send a session_info dict') |
622 | | - |
623 | | - post_authenticated.disconnect(dispatch_uid='test_signal') |
624 | | - |
625 | | - def test_pre_user_save_signal(self): |
626 | | - self.called = [] |
627 | | - |
628 | | - def signal_handler(sender, instance, attributes, user_modified, **kwargs): |
629 | | - self.called.append({'sender': sender, 'instance': instance, 'attributes': attributes, 'user_modified': user_modified}) |
630 | | - |
631 | | - pre_user_save.connect(signal_handler, dispatch_uid='test_signal') |
632 | | - |
633 | | - self.do_login() |
634 | | - |
635 | | - # make sure the handler is only called once |
636 | | - self.assertEqual(len(self.called), 1) |
637 | | - # test 'sender', this should be User.__class__ |
638 | | - self.assertEqual(self.called[0]['sender'], get_user_model(), 'pre_user_save signal sender is not a User') |
639 | | - # test 'instance', this should be User |
640 | | - self.assertIsInstance(self.called[0]['instance'], get_user_model(), 'pre_user_save signal did not send a User instance') |
641 | | - # test the attributes |
642 | | - self.assertIsInstance(self.called[0]['attributes'], dict, 'pre_user_save signal did not send attributes') |
643 | | - # test the user_modified |
644 | | - self.assertIsInstance(self.called[0]['user_modified'], bool, 'pre_user_save signal did not send a user_modified bool') |
645 | | - |
646 | | - pre_user_save.disconnect(dispatch_uid='test_signal') |
647 | | - |
648 | 601 | def test_sigalg_not_passed_when_not_signing_request(self): |
649 | 602 | # monkey patch SAML configuration |
650 | 603 | settings.SAML_CONFIG = conf.create_conf( |
|
0 commit comments