Skip to content

Commit

Permalink
Merge pull request #823 from maykinmedia/feature/1814-update-digid-eh…
Browse files Browse the repository at this point in the history
…erkenning

[#1814] Upgraded digid-eherkenning to 0.9
  • Loading branch information
alextreme authored Nov 1, 2023
2 parents fd379ad + 47351a6 commit 63cd77e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ django-csp==3.7
# via -r requirements/base.in
django-csp-reports==1.8.1
# via -r requirements/base.in
django-digid-eherkenning==0.7.0
django-digid-eherkenning==0.9.0
# via -r requirements/base.in
django-elasticsearch-dsl==7.2.1
# via -r requirements/base.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ django-csp-reports==1.8.1
# via
# -c requirements/base.txt
# -r requirements/base.txt
django-digid-eherkenning==0.7.0
django-digid-eherkenning==0.9.0
# via
# -c requirements/base.txt
# -r requirements/base.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ django-csp-reports==1.8.1
# -r requirements/ci.txt
django-debug-toolbar==3.2.2
# via -r requirements/dev.in
django-digid-eherkenning==0.7.0
django-digid-eherkenning==0.9.0
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
Expand Down
34 changes: 23 additions & 11 deletions src/open_inwoner/accounts/tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import date
from unittest.mock import patch
from urllib.parse import urlencode

from django.contrib.sites.models import Site
Expand Down Expand Up @@ -68,7 +69,11 @@ def test_registration_page_only_digid_with_invite(self):
furl(reverse("digid:login")).add({"next": necessary_url}).url,
)

def test_digid_fail_without_invite_redirects_to_login_page(self):
@patch("digid_eherkenning.validators.Proef11ValidatorBase.__call__")
def test_digid_fail_without_invite_redirects_to_login_page(self, m):
# disable mock form validation to check redirect
m.return_value = True

self.assertNotIn("invite_url", self.client.session.keys())

url = reverse("digid-mock:password")
Expand All @@ -87,7 +92,11 @@ def test_digid_fail_without_invite_redirects_to_login_page(self):

self.assertRedirectsLogin(response, with_host=True)

def test_digid_fail_without_invite_and_next_url_redirects_to_login_page(self):
@patch("digid_eherkenning.validators.Proef11ValidatorBase.__call__")
def test_digid_fail_without_invite_and_next_url_redirects_to_login_page(self, m):
# disable mock form validation to check redirect
m.return_value = True

self.assertNotIn("invite_url", self.client.session.keys())

url = reverse("digid-mock:password")
Expand All @@ -106,7 +115,10 @@ def test_digid_fail_without_invite_and_next_url_redirects_to_login_page(self):

self.assertRedirectsLogin(response, with_host=True)

def test_digid_fail_with_invite_redirects_to_register_page(self):
@patch("digid_eherkenning.validators.Proef11ValidatorBase.__call__")
def test_digid_fail_with_invite_redirects_to_register_page(self, m):
# disable mock form validation to check redirect
m.return_value = True
invite = InviteFactory()
session = self.client.session
session[
Expand Down Expand Up @@ -149,7 +161,7 @@ def test_invite_url_not_in_session_after_successful_login(self):
url = f"{url}?{urlencode(params)}"

data = {
"auth_name": "123456789",
"auth_name": "533458225",
"auth_pass": "bar",
}

Expand All @@ -175,7 +187,7 @@ def test_user_can_modify_only_email_when_digid_and_brp(self, m):
"next": reverse("profile:registration_necessary"),
}
data = {
"auth_name": "123456789",
"auth_name": "533458225",
"auth_pass": "bar",
}
url = f"{url}?{urlencode(params)}"
Expand Down Expand Up @@ -223,7 +235,7 @@ def test_partial_response_from_haalcentraal_when_digid_and_brp(self, m):
"next": reverse("profile:registration_necessary"),
}
data = {
"auth_name": "123456789",
"auth_name": "533458225",
"auth_pass": "bar",
}
url = f"{url}?{urlencode(params)}"
Expand Down Expand Up @@ -260,7 +272,7 @@ def test_first_digid_login_updates_brp_fields(self, m):
url = f"{url}?{urlencode(params)}"

data = {
"auth_name": "123456782",
"auth_name": "533458225",
"auth_pass": "bar",
}
# post our password to the IDP
Expand Down Expand Up @@ -691,7 +703,7 @@ def test_digid_user_success(self):
"""Assert that digid users can register with duplicate emails"""
test_user = DigidUserFactory.create(
email="test@example.com",
bsn="123456789",
bsn="648197724",
)

url = reverse("digid-mock:password")
Expand All @@ -703,7 +715,7 @@ def test_digid_user_success(self):

data = {
# different BSN
"auth_name": "112083948",
"auth_name": "533458225",
"auth_pass": "bar",
}
# post our password to the IDP
Expand Down Expand Up @@ -780,7 +792,7 @@ def test_digid_user_non_digid_duplicate_fail(self):
url = f"{url}?{urlencode(params)}"

data = {
"auth_name": "123456789",
"auth_name": "533458225",
"auth_pass": "bar",
}
# post our password to the IDP
Expand Down Expand Up @@ -816,7 +828,7 @@ def test_digid_user_can_edit_profile(self):
url = f"{url}?{urlencode(params)}"

data = {
"auth_name": "123456782",
"auth_name": "533458225",
"auth_pass": "bar",
}
# post our password to the IDP
Expand Down

0 comments on commit 63cd77e

Please sign in to comment.