Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

✅ Add test for unique together validation for Verzoek bronorganisatie and identificatie #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ unidecode==1.1.1 # via vng-api-common
uritemplate==3.0.0 # via coreapi, drf-yasg
urllib3==1.25.6 # via requests
uwsgi==2.0.18
vng-api-common==1.5.7
vng-api-common==1.5.10
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ unidecode==1.1.1
uritemplate==3.0.0
urllib3==1.25.6
uwsgi==2.0.18
vng-api-common==1.5.7
vng-api-common==1.5.10
waitress==1.3.1
webob==1.8.5
webtest==2.0.33
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ unidecode==1.1.1
uritemplate==3.0.0
urllib3==1.25.6
uwsgi==2.0.18
vng-api-common==1.5.7
vng-api-common==1.5.10
waitress==1.3.1 # via webtest
webob==1.8.5 # via webtest
webtest==2.0.33 # via django-webtest
16 changes: 15 additions & 1 deletion src/verzoeken/api/tests/test_verzoek.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from rest_framework import status
from rest_framework.test import APITestCase
from vng_api_common.tests import JWTAuthMixin, reverse
from vng_api_common.tests import JWTAuthMixin, get_validation_errors, reverse

from verzoeken.datamodel.constants import VerzoekStatus
from verzoeken.datamodel.models import Verzoek
Expand Down Expand Up @@ -127,6 +127,20 @@ def test_pagination_page_param(self):
self.assertIsNone(response_data["previous"])
self.assertIsNone(response_data["next"])

def test_update_verzoek_unique_bronorganisatie_and_identificatie(self):
VerzoekFactory.create(bronorganisatie="000000000", identificatie="unique")

# Create verzoek with same identificatie, but different bronorganisatie
verzoek = VerzoekFactory.create(identificatie="unique")
detail_url = reverse(verzoek)

response = self.client.patch(detail_url, {"bronorganisatie": "000000000"})

self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

error = get_validation_errors(response, "identificatie")
self.assertEqual(error["code"], "identificatie-niet-uniek")


class VerzoekFilterTests(JWTAuthMixin, APITestCase):
heeft_alle_autorisaties = True
Expand Down