-
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.
✅ [#2041] Fix tests for user DB constraints
- Loading branch information
Showing
8 changed files
with
34 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,7 +179,7 @@ def test_existing_user_contact(self): | |
self.assertEqual(existing_user, pending_invitation) | ||
|
||
def test_existing_user_contact_with_case_sensitive_email(self): | ||
existing_user = UserFactory(email="[email protected]", bsn="111111111") | ||
existing_user = DigidUserFactory(email="[email protected]", bsn="111111111") | ||
response = self.app.get(self.create_url, user=self.user) | ||
form = response.forms["contact-form"] | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from unittest import skip | ||
|
||
from django.db import IntegrityError, transaction | ||
from django.test import TestCase | ||
|
||
|
@@ -14,12 +16,11 @@ def test_unique_email_when_login_default(self): | |
with self.assertRaises(IntegrityError): | ||
UserFactory(email="[email protected]", login_type=LoginTypeChoices.default) | ||
|
||
def test_not_unique_email_when_login_not_default(self): | ||
def test_not_unique_email_when_login_digid_or_eherkenning(self): | ||
UserFactory(email="[email protected]", login_type=LoginTypeChoices.default) | ||
|
||
UserFactory(email="[email protected]", login_type=LoginTypeChoices.digid) | ||
UserFactory(email="[email protected]", login_type=LoginTypeChoices.eherkenning) | ||
UserFactory(email="[email protected]", login_type=LoginTypeChoices.oidc) | ||
|
||
def test_unique_bsn_when_login_digid(self): | ||
UserFactory(bsn="123456782", login_type=LoginTypeChoices.digid) | ||
|
@@ -49,6 +50,7 @@ def test_unique_rsin_when_login_herkenning(self): | |
with self.assertRaises(IntegrityError): | ||
UserFactory(rsin="12345678", login_type=LoginTypeChoices.eherkenning) | ||
|
||
@skip("Not yet implemented") | ||
def test_not_both_kvk_and_rsin_when_login_eherkenning(self): | ||
with self.assertRaises(IntegrityError): | ||
UserFactory( | ||
|
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from requests.exceptions import RequestException | ||
from zgw_consumers.constants import APITypes | ||
|
||
from open_inwoner.accounts.models import User | ||
from open_inwoner.accounts.tests.factories import ( | ||
DigidUserFactory, | ||
eHerkenningUserFactory, | ||
|
@@ -38,10 +39,13 @@ def setUpServices(cls): | |
|
||
class MockAPIReadPatchData(MockAPIData): | ||
def __init__(self): | ||
User.objects.filter(email="[email protected]").delete() | ||
self.user = DigidUserFactory( | ||
email="[email protected]", | ||
phonenumber="0100000000", | ||
) | ||
|
||
User.objects.filter(kvk="12345678").delete() | ||
self.eherkenning_user = eHerkenningUserFactory( | ||
email="[email protected]", | ||
kvk="12345678", | ||
|
@@ -103,9 +107,11 @@ def install_mocks_eherkenning(self, m, use_rsin=True) -> "MockAPIReadPatchData": | |
|
||
class MockAPIReadData(MockAPIData): | ||
def __init__(self): | ||
User.objects.filter(bsn="100000001").delete() | ||
self.user = DigidUserFactory( | ||
bsn="100000001", | ||
) | ||
User.objects.filter(kvk="12345678").delete() | ||
self.eherkenning_user = eHerkenningUserFactory( | ||
kvk="12345678", | ||
rsin="000000000", | ||
|
@@ -304,9 +310,11 @@ def install_mocks(self, m, link_objectcontactmomenten=False) -> "MockAPIReadData | |
|
||
class MockAPICreateData(MockAPIData): | ||
def __init__(self): | ||
User.objects.filter(bsn="100000001").delete() | ||
self.user = DigidUserFactory( | ||
bsn="100000001", | ||
) | ||
User.objects.filter(kvk="12345678").delete() | ||
self.eherkenning_user = eHerkenningUserFactory( | ||
kvk="12345678", | ||
rsin="000000000", | ||
|
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