-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #935 from maykinmedia/feature/1999-oidc-user-field…
…s-mapping ♻️ [#1999] Use fixed unique ID fieldname for OIDC
- zgw-import-export-test
- venray-121-pr-1446
- venray-121-pr-1446-v2
- v1.27.2
- v1.27.2-rc1
- v1.27.1
- v1.27.0
- v1.27.0-rc3
- v1.27.0-rc2
- v1.27.0-rc1
- v1.26.2
- v1.26.2-rc1
- v1.26.1
- v1.26.0
- v1.26.0-rc1
- v1.25.0
- v1.24.0
- v1.23.2
- v1.23.1
- v1.23.0
- v1.22.1
- v1.22.0
- v1.21.5
- v1.21.4
- v1.21.3
- v1.21.2
- v1.21.1
- v1.21.0
- v1.20.0
- v1.19.0
- v1.18.2
- v1.18.1
- v1.18.0
- v1.17.5
- v1.17.4
- v1.17.3
- v1.17.2
- v1.17.1
- v1.17.0
- v1.16.5
- v1.16.4
- v1.16.3
- v1.16.2
- v1.16.1
- v1.16
- v1.15.4
- v1.15.3
- v1.15.2
- v1.15.1
- v1.15
- v1.14.5
- v1.14.4
- v1.14.3
- v1.14.2
- v1.14
- v1.13.3
- v1.13.2
- v1.13.1
- v1.13
- test-venray-v11
- test-venray-v10
- test-venray-v9
- test-venray-v8
- test-venray-v7
- test-venray-v6
- test-venray-v5
- test-venray-v4
- test-venray-v3
- test-groningen-siteimprove-2870
- oidc-frontchannel-test
- hoorn-siteimprove-v1
- hoorn-hc-brp-yenlo
- digid-eh-oidc-3
- digid-eh-oidc-2
- digid-eh-oidc-1
Showing
2 changed files
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,7 +226,9 @@ class DigiDOIDCFlowTests(TestCase): | |
@patch("mozilla_django_oidc_db.backends.OIDCAuthenticationBackend.get_token") | ||
@patch( | ||
"digid_eherkenning_oidc_generics.models.OpenIDConnectDigiDConfig.get_solo", | ||
return_value=OpenIDConnectDigiDConfig(id=1, enabled=True), | ||
return_value=OpenIDConnectDigiDConfig( | ||
id=1, enabled=True, identifier_claim_name="sub" | ||
), | ||
) | ||
def test_existing_bsn_creates_no_new_user( | ||
self, | ||
|
@@ -241,8 +243,7 @@ def test_existing_bsn_creates_no_new_user( | |
# sub is the oidc_id field in our db | ||
mock_get_userinfo.return_value = { | ||
"email": "[email protected]", | ||
"sub": "some_username", | ||
"bsn": "123456782", | ||
"sub": "123456782", | ||
} | ||
user = DigidUserFactory.create( | ||
first_name="John", | ||
|
@@ -286,7 +287,9 @@ def test_existing_bsn_creates_no_new_user( | |
@patch("mozilla_django_oidc_db.backends.OIDCAuthenticationBackend.get_token") | ||
@patch( | ||
"digid_eherkenning_oidc_generics.models.OpenIDConnectDigiDConfig.get_solo", | ||
return_value=OpenIDConnectDigiDConfig(id=1, enabled=True), | ||
return_value=OpenIDConnectDigiDConfig( | ||
id=1, enabled=True, identifier_claim_name="sub" | ||
), | ||
) | ||
def test_new_user_is_created_when_new_bsn( | ||
self, | ||
|
@@ -298,7 +301,7 @@ def test_new_user_is_created_when_new_bsn( | |
mock_brp, | ||
): | ||
# set up a user with a non existing email address | ||
mock_get_userinfo.return_value = {"sub": "some_username", "bsn": "000000000"} | ||
mock_get_userinfo.return_value = {"sub": "000000000"} | ||
DigidUserFactory.create(bsn="123456782", email="[email protected]") | ||
session = self.client.session | ||
session["oidc_states"] = {"mock": {"nonce": "nonce"}} | ||
|
@@ -434,7 +437,9 @@ class eHerkenningOIDCFlowTests(TestCase): | |
@patch("mozilla_django_oidc_db.backends.OIDCAuthenticationBackend.get_token") | ||
@patch( | ||
"digid_eherkenning_oidc_generics.models.OpenIDConnectEHerkenningConfig.get_solo", | ||
return_value=OpenIDConnectEHerkenningConfig(id=1, enabled=True), | ||
return_value=OpenIDConnectEHerkenningConfig( | ||
id=1, enabled=True, identifier_claim_name="sub" | ||
), | ||
) | ||
def test_existing_kvk_creates_no_new_user( | ||
self, | ||
|
@@ -455,8 +460,7 @@ def test_existing_kvk_creates_no_new_user( | |
# sub is the oidc_id field in our db | ||
mock_get_userinfo.return_value = { | ||
"email": "[email protected]", | ||
"sub": "some_username", | ||
"kvk": "12345678", | ||
"sub": "12345678", | ||
} | ||
user = eHerkenningUserFactory.create( | ||
first_name="John", | ||
|
@@ -500,7 +504,9 @@ def test_existing_kvk_creates_no_new_user( | |
@patch("mozilla_django_oidc_db.backends.OIDCAuthenticationBackend.get_token") | ||
@patch( | ||
"digid_eherkenning_oidc_generics.models.OpenIDConnectEHerkenningConfig.get_solo", | ||
return_value=OpenIDConnectEHerkenningConfig(id=1, enabled=True), | ||
return_value=OpenIDConnectEHerkenningConfig( | ||
id=1, enabled=True, identifier_claim_name="sub" | ||
), | ||
) | ||
def test_new_user_is_created_when_new_kvk( | ||
self, | ||
|
@@ -513,7 +519,7 @@ def test_new_user_is_created_when_new_kvk( | |
): | ||
mock_retrieve_rsin_with_kvk.return_value = "123456789" | ||
# set up a user with a non existing email address | ||
mock_get_userinfo.return_value = {"sub": "some_username", "kvk": "00000000"} | ||
mock_get_userinfo.return_value = {"sub": "00000000"} | ||
eHerkenningUserFactory.create(kvk="12345678", email="[email protected]") | ||
session = self.client.session | ||
session["oidc_states"] = {"mock": {"nonce": "nonce"}} | ||
|