@@ -1849,7 +1849,7 @@ def _get_detail_url(partij: Partij) -> str:
1849
1849
1850
1850
1851
1851
class PartijIdentificatorTests (APITestCase ):
1852
- def test_list_partij_indetificator (self ):
1852
+ def test_list_partij_identificator (self ):
1853
1853
list_url = reverse ("klantinteracties:partijidentificator-list" )
1854
1854
PartijIdentificator .objects .create (
1855
1855
partij_identificator_code_objecttype = "natuurlijk_persoon" ,
@@ -1883,7 +1883,7 @@ def test_read_partij_identificator(self):
1883
1883
data = response .json ()
1884
1884
self .assertEqual (data ["url" ], "http://testserver" + detail_url )
1885
1885
1886
- def test_create_partij_indetificator (self ):
1886
+ def test_create_partij_identificator (self ):
1887
1887
list_url = reverse ("klantinteracties:partijidentificator-list" )
1888
1888
partij = PartijFactory .create ()
1889
1889
data = {
@@ -1913,7 +1913,7 @@ def test_create_partij_indetificator(self):
1913
1913
},
1914
1914
)
1915
1915
1916
- def test_update_partij_indetificator (self ):
1916
+ def test_update_partij_identificator (self ):
1917
1917
partij , partij2 = PartijFactory .create_batch (2 )
1918
1918
partij_identificator = PartijIdentificatorFactory .create (
1919
1919
partij = partij ,
@@ -1970,7 +1970,7 @@ def test_update_partij_indetificator(self):
1970
1970
},
1971
1971
)
1972
1972
1973
- def test_partial_update_partij_indetificator (self ):
1973
+ def test_partial_update_partij_identificator (self ):
1974
1974
partij = PartijFactory .create ()
1975
1975
partij_identificator = PartijIdentificatorFactory .create (
1976
1976
partij = partij ,
@@ -2034,85 +2034,31 @@ def test_destroy_partij_identificator(self):
2034
2034
data = response .json ()
2035
2035
self .assertEqual (data ["count" ], 0 )
2036
2036
2037
- def test_invalid_choice_partij_identificator_code_register (self ):
2038
- url = reverse ("klantinteracties:partijidentificator-list" )
2039
- partij = PartijFactory .create ()
2040
- data = {
2041
- "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2042
- "anderePartijIdentificator" : "anderePartijIdentificator" ,
2043
- "partijIdentificator" : {
2044
- "codeObjecttype" : "natuurlijk_persoon" ,
2045
- "codeSoortObjectId" : "bsn" ,
2046
- "objectId" : "296648875" ,
2047
- "codeRegister" : "test" ,
2048
- },
2049
- }
2050
- response = self .client .post (url , data )
2051
- self .assertEqual (response .status_code , status .HTTP_400_BAD_REQUEST )
2052
- self .assertEqual (response .data ["code" ], "invalid" )
2053
- self .assertEqual (response .data ["title" ], "Invalid input." )
2054
- self .assertEqual (
2055
- response .data ["invalid_params" ][0 ]["name" ],
2056
- "partijIdentificator.codeRegister" ,
2057
- )
2058
- self .assertEqual (response .data ["invalid_params" ][0 ]["code" ], "invalid_choice" )
2059
- self .assertEqual (
2060
- response .data ["invalid_params" ][0 ]["reason" ],
2061
- '"test" is een ongeldige keuze.' ,
2062
- )
2063
-
2064
- def test_invalid_choice_partij_identificator_code_objecttype (self ):
2037
+ def test_invalid_choices_partij_identificator (self ):
2065
2038
url = reverse ("klantinteracties:partijidentificator-list" )
2066
2039
partij = PartijFactory .create ()
2067
2040
data = {
2068
2041
"identificeerdePartij" : {"uuid" : str (partij .uuid )},
2069
2042
"anderePartijIdentificator" : "anderePartijIdentificator" ,
2070
2043
"partijIdentificator" : {
2071
2044
"codeObjecttype" : "test" ,
2072
- "codeSoortObjectId" : "bsn" ,
2073
- "objectId" : "296648875" ,
2074
- "codeRegister" : "brp" ,
2075
- },
2076
- }
2077
- response = self .client .post (url , data )
2078
- self .assertEqual (response .status_code , status .HTTP_400_BAD_REQUEST )
2079
- self .assertEqual (response .data ["code" ], "invalid" )
2080
- self .assertEqual (response .data ["title" ], "Invalid input." )
2081
- self .assertEqual (
2082
- response .data ["invalid_params" ][0 ]["name" ],
2083
- "partijIdentificator.codeObjecttype" ,
2084
- )
2085
- self .assertEqual (response .data ["invalid_params" ][0 ]["code" ], "invalid_choice" )
2086
- self .assertEqual (
2087
- response .data ["invalid_params" ][0 ]["reason" ],
2088
- '"test" is een ongeldige keuze.' ,
2089
- )
2090
-
2091
- def test_invalid_choice_partij_identificator_code_soort_object_id (self ):
2092
- url = reverse ("klantinteracties:partijidentificator-list" )
2093
- partij = PartijFactory .create ()
2094
- data = {
2095
- "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2096
- "anderePartijIdentificator" : "anderePartijIdentificator" ,
2097
- "partijIdentificator" : {
2098
- "codeObjecttype" : "natuurlijk_persoon" ,
2099
2045
"codeSoortObjectId" : "test" ,
2100
- "objectId" : "296648875 " ,
2101
- "codeRegister" : "brp " ,
2046
+ "objectId" : "" ,
2047
+ "codeRegister" : "test " ,
2102
2048
},
2103
2049
}
2104
2050
response = self .client .post (url , data )
2105
2051
self .assertEqual (response .status_code , status .HTTP_400_BAD_REQUEST )
2106
2052
self .assertEqual (response .data ["code" ], "invalid" )
2107
2053
self .assertEqual (response .data ["title" ], "Invalid input." )
2054
+ self .assertEqual (len (response .data ["invalid_params" ]), 3 )
2108
2055
self .assertEqual (
2109
- response .data ["invalid_params" ][0 ]["name" ],
2110
- "partijIdentificator.codeSoortObjectId" ,
2111
- )
2112
- self .assertEqual (response .data ["invalid_params" ][0 ]["code" ], "invalid_choice" )
2113
- self .assertEqual (
2114
- response .data ["invalid_params" ][0 ]["reason" ],
2115
- '"test" is een ongeldige keuze.' ,
2056
+ {item ["name" ] for item in response .data ["invalid_params" ]},
2057
+ {
2058
+ "partijIdentificator.codeObjecttype" ,
2059
+ "partijIdentificator.codeRegister" ,
2060
+ "partijIdentificator.codeSoortObjectId" ,
2061
+ },
2116
2062
)
2117
2063
2118
2064
def test_invalid_validation_partij_identificator_code_objecttype (self ):
@@ -2198,98 +2144,6 @@ def test_invalid_validation_partij_identificator_object_id(self):
2198
2144
"Deze waarde is ongeldig, reden: Waarde moet 9 tekens lang zijn" ,
2199
2145
)
2200
2146
2201
- def test_invalid_overig_code_objecttype_validation_partij_identificator (self ):
2202
- # Overig no validation
2203
- url = reverse ("klantinteracties:partijidentificator-list" )
2204
- partij = PartijFactory .create ()
2205
- data = {
2206
- "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2207
- "anderePartijIdentificator" : "anderePartijIdentificator" ,
2208
- "partijIdentificator" : {
2209
- "codeObjecttype" : "overig" ,
2210
- "codeSoortObjectId" : "bsn" ,
2211
- "objectId" : "296648875" ,
2212
- "codeRegister" : "brp" ,
2213
- },
2214
- }
2215
- response = self .client .post (url , data )
2216
- self .assertEqual (response .status_code , status .HTTP_400_BAD_REQUEST )
2217
- self .assertEqual (response .data ["code" ], "invalid" )
2218
- self .assertEqual (response .data ["title" ], "Invalid input." )
2219
- self .assertEqual (
2220
- response .data ["invalid_params" ][0 ]["name" ],
2221
- "partijIdentificator.nonFieldErrors" ,
2222
- )
2223
- self .assertEqual (response .data ["invalid_params" ][0 ]["code" ], "invalid" )
2224
- self .assertEqual (
2225
- response .data ["invalid_params" ][0 ]["reason" ],
2226
- "voor `codeRegister` brp zijn alleen deze waarden toegestaan: ['natuurlijk_persoon']" ,
2227
- )
2228
-
2229
- def test_valid_validation_partij_identificator (self ):
2230
- # All validations pass
2231
- url = reverse ("klantinteracties:partijidentificator-list" )
2232
- partij = PartijFactory .create ()
2233
- data = {
2234
- "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2235
- "anderePartijIdentificator" : "anderePartijIdentificator" ,
2236
- "partijIdentificator" : {
2237
- "codeObjecttype" : "natuurlijk_persoon" ,
2238
- "codeSoortObjectId" : "bsn" ,
2239
- "objectId" : "296648875" ,
2240
- "codeRegister" : "brp" ,
2241
- },
2242
- }
2243
- response = self .client .post (url , data )
2244
- self .assertEqual (response .status_code , status .HTTP_201_CREATED )
2245
- self .assertEqual (
2246
- response .data ["partij_identificator" ]["code_objecttype" ],
2247
- "natuurlijk_persoon" ,
2248
- )
2249
- self .assertEqual (
2250
- response .data ["partij_identificator" ]["code_soort_object_id" ],
2251
- "bsn" ,
2252
- )
2253
- self .assertEqual (
2254
- response .data ["partij_identificator" ]["object_id" ], "296648875"
2255
- )
2256
- self .assertEqual (
2257
- response .data ["partij_identificator" ]["code_register" ],
2258
- "brp" ,
2259
- )
2260
-
2261
- def test_valid_overig_code_register_validation_partij_identificator (self ):
2262
- # Overig no validation
2263
- url = reverse ("klantinteracties:partijidentificator-list" )
2264
- partij = PartijFactory .create ()
2265
- data = {
2266
- "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2267
- "anderePartijIdentificator" : "anderePartijIdentificator" ,
2268
- "partijIdentificator" : {
2269
- "codeObjecttype" : "natuurlijk_persoon" ,
2270
- "codeSoortObjectId" : "bsn" ,
2271
- "objectId" : "296648875" ,
2272
- "codeRegister" : "overig" ,
2273
- },
2274
- }
2275
- response = self .client .post (url , data )
2276
- self .assertEqual (response .status_code , status .HTTP_201_CREATED )
2277
- self .assertEqual (
2278
- response .data ["partij_identificator" ]["code_objecttype" ],
2279
- "natuurlijk_persoon" ,
2280
- )
2281
- self .assertEqual (
2282
- response .data ["partij_identificator" ]["code_soort_object_id" ],
2283
- "bsn" ,
2284
- )
2285
- self .assertEqual (
2286
- response .data ["partij_identificator" ]["object_id" ], "296648875"
2287
- )
2288
- self .assertEqual (
2289
- response .data ["partij_identificator" ]["code_register" ],
2290
- "overig" ,
2291
- )
2292
-
2293
2147
2294
2148
class CategorieRelatieTests (APITestCase ):
2295
2149
def test_list_categorie_relatie (self ):
0 commit comments