Skip to content

Commit

Permalink
feat: DiscoveryService unit test - coverage up to 89%
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelinux committed May 22, 2021
1 parent 57ad2ba commit 86a5dc7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion djangosaml2/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,17 @@ def test_sigalg_passed_when_signing_request(self):
_args, kwargs = prepare_for_auth_mock.call_args
self.assertIn('sigalg', kwargs)

@override_settings(SAML2_DISCO_URL="https://that-ds.org/ds")
def test_discovery_service(self):
settings.SAML_CONFIG = conf.create_conf(
sp_host='sp.example.com',
idp_hosts=['idp.example.com'],
metadata_file='remote_metadata_three_idps.xml',
)

response = self.client.get(reverse('saml2_login'))
self.assertEqual(response.status_code, 302)
self.assertIn("https://that-ds.org/ds", response.url)

def test_config_loader(request):
config = SPConfig()
Expand Down Expand Up @@ -746,6 +757,5 @@ def test_middleware_cookie_with_expiry(self):
cookie = response.cookies[saml_session_name]

self.assertIsNotNone(cookie['expires'])

self.assertNotEqual(cookie['expires'], '')
self.assertNotEqual(cookie['max-age'], '')

0 comments on commit 86a5dc7

Please sign in to comment.