Skip to content

Commit

Permalink
⚰️ [#3969] Remove obsolete tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Mar 22, 2024
1 parent f43db63 commit 078e0b2
Showing 1 changed file with 0 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from django.utils.safestring import mark_safe

import requests_mock
from digid_eherkenning.choices import AssuranceLevels
from digid_eherkenning.models import EherkenningConfiguration
from freezegun import freeze_time
from furl import furl
Expand Down Expand Up @@ -180,70 +179,6 @@ def test_authn_request(self, mock_id):
},
)

@freeze_time("2020-04-09T08:31:46Z")
@patch(
"onelogin.saml2.authn_request.OneLogin_Saml2_Utils.generate_unique_id",
return_value="ONELOGIN_123456",
)
def test_authn_request_uses_minimal_loa_from_form(self, mock_id):
form = FormFactory.create(
authentication_backends=["eherkenning"],
authentication_backend_options={
"eherkenning": {"loa": AssuranceLevels.high}
},
generate_minimal_setup=True,
formstep__form_definition__login_required=True,
)
login_url = reverse(
"authentication:start",
kwargs={"slug": form.slug, "plugin_id": "eherkenning"},
)
form_path = reverse("core:form-detail", kwargs={"slug": form.slug})
form_url = f"https://testserver{form_path}"
login_url = furl(login_url).set({"next": form_url})

response = self.client.get(login_url.url, follow=True)

return_url = reverse(
"authentication:return",
kwargs={"slug": form.slug, "plugin_id": "eherkenning"},
)
full_return_url = furl(return_url).add({"next": form_url})

self.assertEqual(
response.context["form"].initial["RelayState"],
str(full_return_url),
)

saml_request = b64decode(
response.context["form"].initial["SAMLRequest"].encode("utf-8")
)
tree = etree.fromstring(saml_request)

self.assertEqual(
tree.attrib,
{
"ID": "ONELOGIN_123456",
"Version": "2.0",
"ForceAuthn": "true",
"IssueInstant": "2020-04-09T08:31:46Z",
"Destination": "https://test-iwelcome.nl/broker/sso/1.13",
"ProtocolBinding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact",
"AssertionConsumerServiceURL": "https://test-sp.nl/eherkenning/acs/",
"AttributeConsumingServiceIndex": "8888",
},
)

auth_context_class_ref = tree.xpath(
"samlp:RequestedAuthnContext[@Comparison='minimum']/saml:AuthnContextClassRef",
namespaces={
"samlp": "urn:oasis:names:tc:SAML:2.0:protocol",
"saml": "urn:oasis:names:tc:SAML:2.0:assertion",
},
)[0]

self.assertEqual(auth_context_class_ref.text, AssuranceLevels.high.value)


@override_settings(CORS_ALLOW_ALL_ORIGINS=True)
@temp_private_root()
Expand Down

0 comments on commit 078e0b2

Please sign in to comment.