Skip to content

Commit 5639fa0

Browse files
[#311] Add country dict
[#311] Update models + migrations [#311] Create Tests Schema
1 parent f778cd5 commit 5639fa0

26 files changed

+1266
-264
lines changed

requirements/base.in

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ open-api-framework
22

33
django-setup-configuration
44
mozilla-django-oidc-db[setup-configuration]
5+
6+
django-localflavor

requirements/base.txt

+5
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ django==4.2.17
8181
# django-filter
8282
# django-formtools
8383
# django-jsonform
84+
# django-localflavor
8485
# django-log-outgoing-requests
8586
# django-markup
8687
# django-otp
@@ -126,6 +127,8 @@ django-jsonform==2.22.0
126127
# via
127128
# mozilla-django-oidc-db
128129
# open-api-framework
130+
django-localflavor==4.0
131+
# via -r requirements/base.in
129132
django-log-outgoing-requests==0.6.1
130133
# via open-api-framework
131134
django-markup==1.8.1
@@ -279,6 +282,8 @@ python-dotenv==1.0.1
279282
# via
280283
# open-api-framework
281284
# pydantic-settings
285+
python-stdnum==1.20
286+
# via django-localflavor
282287
pytz==2024.1
283288
# via flower
284289
pyyaml==6.0.1

requirements/ci.txt

+7
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ django==4.2.17
162162
# django-filter
163163
# django-formtools
164164
# django-jsonform
165+
# django-localflavor
165166
# django-log-outgoing-requests
166167
# django-markup
167168
# django-otp
@@ -229,6 +230,8 @@ django-jsonform==2.22.0
229230
# -r requirements/base.txt
230231
# mozilla-django-oidc-db
231232
# open-api-framework
233+
django-localflavor==4.0
234+
# via -r requirements/base.txt
232235
django-log-outgoing-requests==0.6.1
233236
# via
234237
# -c requirements/base.txt
@@ -619,6 +622,10 @@ python-dotenv==1.0.1
619622
# -r requirements/base.txt
620623
# open-api-framework
621624
# pydantic-settings
625+
python-stdnum==1.20
626+
# via
627+
# -r requirements/base.txt
628+
# django-localflavor
622629
pytz==2024.1
623630
# via
624631
# -c requirements/base.txt

requirements/dev.txt

+7
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ django==4.2.17
197197
# django-filter
198198
# django-formtools
199199
# django-jsonform
200+
# django-localflavor
200201
# django-log-outgoing-requests
201202
# django-markup
202203
# django-otp
@@ -268,6 +269,8 @@ django-jsonform==2.22.0
268269
# -r requirements/ci.txt
269270
# mozilla-django-oidc-db
270271
# open-api-framework
272+
django-localflavor==4.0
273+
# via -r requirements/base.txt
271274
django-log-outgoing-requests==0.6.1
272275
# via
273276
# -c requirements/ci.txt
@@ -731,6 +734,10 @@ python-dotenv==1.0.1
731734
# -r requirements/ci.txt
732735
# open-api-framework
733736
# pydantic-settings
737+
python-stdnum==1.20
738+
# via
739+
# -r requirements/base.txt
740+
# django-localflavor
734741
pytz==2024.1
735742
# via
736743
# -c requirements/ci.txt

src/openklant/components/contactgegevens/api/tests/test_apis.py

+45-44
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def test_persoon_detail(self):
2121
adres_adresregel1="adresregel1",
2222
adres_adresregel2="adresregel2",
2323
adres_adresregel3="adresregel3",
24-
adres_land="5001",
25-
land="5001",
24+
adres_land="CA",
25+
land="CA",
2626
)
2727
detail_url = reverse(
2828
"contactgegevens:persoon-detail",
@@ -34,7 +34,7 @@ def test_persoon_detail(self):
3434
"adresregel1": "adresregel1",
3535
"adresregel2": "adresregel2",
3636
"adresregel3": "adresregel3",
37-
"land": "5001",
37+
"land": "CA",
3838
}
3939
expected_data = {
4040
"uuid": str(persoon.uuid),
@@ -46,7 +46,7 @@ def test_persoon_detail(self):
4646
"voorvoegsel": "",
4747
"voornamen": "John",
4848
"adres": expected_adres,
49-
"land": "5001",
49+
"land": "CA",
5050
}
5151

5252
response = self.client.get(detail_url)
@@ -68,9 +68,9 @@ def test_create_persoon(self):
6868
"adresregel1": "adresregel1",
6969
"adresregel2": "adresregel2",
7070
"adresregel3": "adresregel3",
71-
"land": "5001",
71+
"land": "CA",
7272
},
73-
"land": "5001",
73+
"land": "CA",
7474
}
7575

7676
response = self.client.post(list_url, data)
@@ -92,10 +92,10 @@ def test_create_persoon(self):
9292
"adresregel1": "adresregel1",
9393
"adresregel2": "adresregel2",
9494
"adresregel3": "adresregel3",
95-
"land": "5001",
95+
"land": "CA",
9696
},
9797
)
98-
self.assertEqual(data["land"], "5001")
98+
self.assertEqual(data["land"], "CA")
9999

100100
def test_update_persoon(self):
101101
persoon = PersoonFactory.create(
@@ -109,8 +109,8 @@ def test_update_persoon(self):
109109
adres_adresregel1="adresregel1",
110110
adres_adresregel2="adresregel2",
111111
adres_adresregel3="adresregel3",
112-
adres_land="5001",
113-
land="5001",
112+
adres_land="CA",
113+
land="CA",
114114
)
115115
detail_url = reverse(
116116
"contactgegevens:persoon-detail",
@@ -136,10 +136,10 @@ def test_update_persoon(self):
136136
"adresregel1": "adresregel1",
137137
"adresregel2": "adresregel2",
138138
"adresregel3": "adresregel3",
139-
"land": "5001",
139+
"land": "CA",
140140
},
141141
)
142-
self.assertEqual(data["land"], "5001")
142+
self.assertEqual(data["land"], "CA")
143143

144144
data = {
145145
"geboortedatum": "1972-05-06",
@@ -153,12 +153,13 @@ def test_update_persoon(self):
153153
"adresregel1": "changed",
154154
"adresregel2": "changed",
155155
"adresregel3": "changed",
156-
"land": "6713",
156+
"land": "FR",
157157
},
158-
"land": "6713",
158+
"land": "FR",
159159
}
160160
response = self.client.put(detail_url, data)
161161
data = response.json()
162+
162163
self.assertEqual(data["geboortedatum"], "1972-05-06")
163164
self.assertEqual(data["overlijdensdatum"], "2023-11-22")
164165
self.assertEqual(data["geslachtsnaam"], "changed")
@@ -172,10 +173,10 @@ def test_update_persoon(self):
172173
"adresregel1": "changed",
173174
"adresregel2": "changed",
174175
"adresregel3": "changed",
175-
"land": "6713",
176+
"land": "FR",
176177
},
177178
)
178-
self.assertEqual(data["land"], "6713")
179+
self.assertEqual(data["land"], "FR")
179180

180181
def test_update_partial_persoon(self):
181182
persoon = PersoonFactory.create(
@@ -189,8 +190,8 @@ def test_update_partial_persoon(self):
189190
adres_adresregel1="adresregel1",
190191
adres_adresregel2="adresregel2",
191192
adres_adresregel3="adresregel3",
192-
adres_land="5001",
193-
land="5001",
193+
adres_land="CA",
194+
land="CA",
194195
)
195196
detail_url = reverse(
196197
"contactgegevens:persoon-detail",
@@ -216,10 +217,10 @@ def test_update_partial_persoon(self):
216217
"adresregel1": "adresregel1",
217218
"adresregel2": "adresregel2",
218219
"adresregel3": "adresregel3",
219-
"land": "5001",
220+
"land": "CA",
220221
},
221222
)
222-
self.assertEqual(data["land"], "5001")
223+
self.assertEqual(data["land"], "CA")
223224

224225
data = {
225226
"overlijdensdatum": "2023-11-22",
@@ -240,10 +241,10 @@ def test_update_partial_persoon(self):
240241
"adresregel1": "adresregel1",
241242
"adresregel2": "adresregel2",
242243
"adresregel3": "adresregel3",
243-
"land": "5001",
244+
"land": "CA",
244245
},
245246
)
246-
self.assertEqual(data["land"], "5001")
247+
self.assertEqual(data["land"], "CA")
247248

248249
def test_list_pagination_pagesize_param(self):
249250
list_url = reverse("contactgegevens:persoon-list")
@@ -269,8 +270,8 @@ def test_organisatie_detail(self):
269270
adres_adresregel1="adresregel1",
270271
adres_adresregel2="adresregel2",
271272
adres_adresregel3="adresregel3",
272-
adres_land="5001",
273-
land="5001",
273+
adres_land="CA",
274+
land="CA",
274275
)
275276
detail_url = reverse(
276277
"contactgegevens:organisatie-detail",
@@ -282,7 +283,7 @@ def test_organisatie_detail(self):
282283
"adresregel1": "adresregel1",
283284
"adresregel2": "adresregel2",
284285
"adresregel3": "adresregel3",
285-
"land": "5001",
286+
"land": "CA",
286287
}
287288
expected_data = {
288289
"uuid": str(organisatie.uuid),
@@ -291,7 +292,7 @@ def test_organisatie_detail(self):
291292
"opheffingsdatum": "2020-09-05",
292293
"handelsnaam": "Devin Townsend",
293294
"adres": expected_adres,
294-
"land": "5001",
295+
"land": "CA",
295296
}
296297

297298
response = self.client.get(detail_url)
@@ -311,9 +312,9 @@ def test_create_organisatie(self):
311312
"adresregel1": "adresregel1",
312313
"adresregel2": "adresregel2",
313314
"adresregel3": "adresregel3",
314-
"land": "5001",
315+
"land": "CA",
315316
},
316-
"land": "5001",
317+
"land": "CA",
317318
}
318319

319320
response = self.client.post(list_url, data)
@@ -332,10 +333,10 @@ def test_create_organisatie(self):
332333
"adresregel1": "adresregel1",
333334
"adresregel2": "adresregel2",
334335
"adresregel3": "adresregel3",
335-
"land": "5001",
336+
"land": "CA",
336337
},
337338
)
338-
self.assertEqual(data["land"], "5001")
339+
self.assertEqual(data["land"], "CA")
339340

340341
def test_update_organisatie(self):
341342
organisatie = OrganisatieFactory.create(
@@ -346,8 +347,8 @@ def test_update_organisatie(self):
346347
adres_adresregel1="adresregel1",
347348
adres_adresregel2="adresregel2",
348349
adres_adresregel3="adresregel3",
349-
adres_land="5001",
350-
land="5001",
350+
adres_land="CA",
351+
land="CA",
351352
)
352353
detail_url = reverse(
353354
"contactgegevens:organisatie-detail",
@@ -370,10 +371,10 @@ def test_update_organisatie(self):
370371
"adresregel1": "adresregel1",
371372
"adresregel2": "adresregel2",
372373
"adresregel3": "adresregel3",
373-
"land": "5001",
374+
"land": "CA",
374375
},
375376
)
376-
self.assertEqual(data["land"], "5001")
377+
self.assertEqual(data["land"], "CA")
377378

378379
data = {
379380
"handelsnaam": "changed",
@@ -384,9 +385,9 @@ def test_update_organisatie(self):
384385
"adresregel1": "changed",
385386
"adresregel2": "changed",
386387
"adresregel3": "changed",
387-
"land": "6713",
388+
"land": "FR",
388389
},
389-
"land": "6713",
390+
"land": "FR",
390391
}
391392
response = self.client.put(detail_url, data)
392393
data = response.json()
@@ -400,10 +401,10 @@ def test_update_organisatie(self):
400401
"adresregel1": "changed",
401402
"adresregel2": "changed",
402403
"adresregel3": "changed",
403-
"land": "6713",
404+
"land": "FR",
404405
},
405406
)
406-
self.assertEqual(data["land"], "6713")
407+
self.assertEqual(data["land"], "FR")
407408

408409
def test_update_partial_organisatie(self):
409410
organisatie = OrganisatieFactory.create(
@@ -414,8 +415,8 @@ def test_update_partial_organisatie(self):
414415
adres_adresregel1="adresregel1",
415416
adres_adresregel2="adresregel2",
416417
adres_adresregel3="adresregel3",
417-
adres_land="5001",
418-
land="5001",
418+
adres_land="CA",
419+
land="CA",
419420
)
420421
detail_url = reverse(
421422
"contactgegevens:organisatie-detail",
@@ -438,10 +439,10 @@ def test_update_partial_organisatie(self):
438439
"adresregel1": "adresregel1",
439440
"adresregel2": "adresregel2",
440441
"adresregel3": "adresregel3",
441-
"land": "5001",
442+
"land": "CA",
442443
},
443444
)
444-
self.assertEqual(data["land"], "5001")
445+
self.assertEqual(data["land"], "CA")
445446

446447
data = {
447448
"opheffingsdatum": "2023-11-22",
@@ -460,10 +461,10 @@ def test_update_partial_organisatie(self):
460461
"adresregel1": "adresregel1",
461462
"adresregel2": "adresregel2",
462463
"adresregel3": "adresregel3",
463-
"land": "5001",
464+
"land": "CA",
464465
},
465466
)
466-
self.assertEqual(data["land"], "5001")
467+
self.assertEqual(data["land"], "CA")
467468

468469
def test_list_pagination_pagesize_param(self):
469470
list_url = reverse("contactgegevens:organisatie-list")

0 commit comments

Comments
 (0)