Skip to content

Commit 21ed08b

Browse files
[#267] Delete duplicated tests
1 parent 97970e5 commit 21ed08b

File tree

1 file changed

+14
-160
lines changed

1 file changed

+14
-160
lines changed

src/openklant/components/klantinteracties/api/tests/test_partijen.py

+14-160
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ def _get_detail_url(partij: Partij) -> str:
18491849

18501850

18511851
class PartijIdentificatorTests(APITestCase):
1852-
def test_list_partij_indetificator(self):
1852+
def test_list_partij_identificator(self):
18531853
list_url = reverse("klantinteracties:partijidentificator-list")
18541854
PartijIdentificator.objects.create(
18551855
partij_identificator_code_objecttype="natuurlijk_persoon",
@@ -1883,7 +1883,7 @@ def test_read_partij_identificator(self):
18831883
data = response.json()
18841884
self.assertEqual(data["url"], "http://testserver" + detail_url)
18851885

1886-
def test_create_partij_indetificator(self):
1886+
def test_create_partij_identificator(self):
18871887
list_url = reverse("klantinteracties:partijidentificator-list")
18881888
partij = PartijFactory.create()
18891889
data = {
@@ -1913,7 +1913,7 @@ def test_create_partij_indetificator(self):
19131913
},
19141914
)
19151915

1916-
def test_update_partij_indetificator(self):
1916+
def test_update_partij_identificator(self):
19171917
partij, partij2 = PartijFactory.create_batch(2)
19181918
partij_identificator = PartijIdentificatorFactory.create(
19191919
partij=partij,
@@ -1970,7 +1970,7 @@ def test_update_partij_indetificator(self):
19701970
},
19711971
)
19721972

1973-
def test_partial_update_partij_indetificator(self):
1973+
def test_partial_update_partij_identificator(self):
19741974
partij = PartijFactory.create()
19751975
partij_identificator = PartijIdentificatorFactory.create(
19761976
partij=partij,
@@ -2034,85 +2034,31 @@ def test_destroy_partij_identificator(self):
20342034
data = response.json()
20352035
self.assertEqual(data["count"], 0)
20362036

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):
20652038
url = reverse("klantinteracties:partijidentificator-list")
20662039
partij = PartijFactory.create()
20672040
data = {
20682041
"identificeerdePartij": {"uuid": str(partij.uuid)},
20692042
"anderePartijIdentificator": "anderePartijIdentificator",
20702043
"partijIdentificator": {
20712044
"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",
20992045
"codeSoortObjectId": "test",
2100-
"objectId": "296648875",
2101-
"codeRegister": "brp",
2046+
"objectId": "",
2047+
"codeRegister": "test",
21022048
},
21032049
}
21042050
response = self.client.post(url, data)
21052051
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
21062052
self.assertEqual(response.data["code"], "invalid")
21072053
self.assertEqual(response.data["title"], "Invalid input.")
2054+
self.assertEqual(len(response.data["invalid_params"]), 3)
21082055
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+
},
21162062
)
21172063

21182064
def test_invalid_validation_partij_identificator_code_objecttype(self):
@@ -2198,98 +2144,6 @@ def test_invalid_validation_partij_identificator_object_id(self):
21982144
"Deze waarde is ongeldig, reden: Waarde moet 9 tekens lang zijn",
21992145
)
22002146

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-
22932147

22942148
class CategorieRelatieTests(APITestCase):
22952149
def test_list_categorie_relatie(self):

0 commit comments

Comments
 (0)