-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add explicit API test to check if no validation is applied if soort != email * remove re-raising of validationerrors for email validation in case of API context * move retrieval of soort_digitaal_adres to caller code (admin/serializer.validate)
- Loading branch information
Showing
5 changed files
with
44 additions
and
25 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
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,4 @@ | ||
from django.test import tag | ||
from django.utils.translation import gettext as _ | ||
|
||
from rest_framework import status | ||
|
@@ -92,6 +93,7 @@ def test_create_digitaal_adres(self): | |
self.assertEqual(data["adres"], "[email protected]") | ||
self.assertEqual(data["omschrijving"], "omschrijving") | ||
|
||
@tag("gh-234") | ||
def test_create_digitaal_adres_email_validation(self): | ||
list_url = reverse("klantinteracties:digitaaladres-list") | ||
data = { | ||
|
@@ -140,6 +142,24 @@ def test_create_digitaal_adres_email_validation(self): | |
], | ||
) | ||
|
||
with self.subTest("no validation applied if soort is not email"): | ||
response = self.client.patch( | ||
detail_url, | ||
{ | ||
"soortDigitaalAdres": SoortDigitaalAdres.telefoonnummer, | ||
"adres": "0612345678", | ||
}, | ||
) | ||
|
||
self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
|
||
digitaal_adres.refresh_from_db() | ||
|
||
self.assertEqual( | ||
digitaal_adres.soort_digitaal_adres, SoortDigitaalAdres.telefoonnummer | ||
) | ||
self.assertEqual(digitaal_adres.adres, "0612345678") | ||
|
||
def test_update_digitaal_adres(self): | ||
betrokkene, betrokkene2 = BetrokkeneFactory.create_batch(2) | ||
partij, partij2 = PartijFactory.create_batch(2) | ||
|
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