Skip to content

Commit

Permalink
[#311] Fix Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Jan 9, 2025
1 parent 32f6164 commit e442bb0
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 145 deletions.
89 changes: 45 additions & 44 deletions src/openklant/components/contactgegevens/api/tests/test_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def test_persoon_detail(self):
adres_adresregel1="adresregel1",
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="5001",
land="5001",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:persoon-detail",
Expand All @@ -34,7 +34,7 @@ def test_persoon_detail(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
}
expected_data = {
"uuid": str(persoon.uuid),
Expand All @@ -46,7 +46,7 @@ def test_persoon_detail(self):
"voorvoegsel": "",
"voornamen": "John",
"adres": expected_adres,
"land": "5001",
"land": "CA",
}

response = self.client.get(detail_url)
Expand All @@ -68,9 +68,9 @@ def test_create_persoon(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
"land": "5001",
"land": "CA",
}

response = self.client.post(list_url, data)
Expand All @@ -92,10 +92,10 @@ def test_create_persoon(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
)
self.assertEqual(data["land"], "5001")
self.assertEqual(data["land"], "CA")

def test_update_persoon(self):
persoon = PersoonFactory.create(
Expand All @@ -109,8 +109,8 @@ def test_update_persoon(self):
adres_adresregel1="adresregel1",
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="5001",
land="5001",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:persoon-detail",
Expand All @@ -136,10 +136,10 @@ def test_update_persoon(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
)
self.assertEqual(data["land"], "5001")
self.assertEqual(data["land"], "CA")

data = {
"geboortedatum": "1972-05-06",
Expand All @@ -153,12 +153,13 @@ def test_update_persoon(self):
"adresregel1": "changed",
"adresregel2": "changed",
"adresregel3": "changed",
"land": "6713",
"land": "FR",
},
"land": "6713",
"land": "FR",
}
response = self.client.put(detail_url, data)
data = response.json()

self.assertEqual(data["geboortedatum"], "1972-05-06")
self.assertEqual(data["overlijdensdatum"], "2023-11-22")
self.assertEqual(data["geslachtsnaam"], "changed")
Expand All @@ -172,10 +173,10 @@ def test_update_persoon(self):
"adresregel1": "changed",
"adresregel2": "changed",
"adresregel3": "changed",
"land": "6713",
"land": "FR",
},
)
self.assertEqual(data["land"], "6713")
self.assertEqual(data["land"], "FR")

def test_update_partial_persoon(self):
persoon = PersoonFactory.create(
Expand All @@ -189,8 +190,8 @@ def test_update_partial_persoon(self):
adres_adresregel1="adresregel1",
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="5001",
land="5001",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:persoon-detail",
Expand All @@ -216,10 +217,10 @@ def test_update_partial_persoon(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
)
self.assertEqual(data["land"], "5001")
self.assertEqual(data["land"], "CA")

data = {
"overlijdensdatum": "2023-11-22",
Expand All @@ -240,10 +241,10 @@ def test_update_partial_persoon(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
)
self.assertEqual(data["land"], "5001")
self.assertEqual(data["land"], "CA")

def test_list_pagination_pagesize_param(self):
list_url = reverse("contactgegevens:persoon-list")
Expand All @@ -269,8 +270,8 @@ def test_organisatie_detail(self):
adres_adresregel1="adresregel1",
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="5001",
land="5001",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:organisatie-detail",
Expand All @@ -282,7 +283,7 @@ def test_organisatie_detail(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
}
expected_data = {
"uuid": str(organisatie.uuid),
Expand All @@ -291,7 +292,7 @@ def test_organisatie_detail(self):
"opheffingsdatum": "2020-09-05",
"handelsnaam": "Devin Townsend",
"adres": expected_adres,
"land": "5001",
"land": "CA",
}

response = self.client.get(detail_url)
Expand All @@ -311,9 +312,9 @@ def test_create_organisatie(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
"land": "5001",
"land": "CA",
}

response = self.client.post(list_url, data)
Expand All @@ -332,10 +333,10 @@ def test_create_organisatie(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
)
self.assertEqual(data["land"], "5001")
self.assertEqual(data["land"], "CA")

def test_update_organisatie(self):
organisatie = OrganisatieFactory.create(
Expand All @@ -346,8 +347,8 @@ def test_update_organisatie(self):
adres_adresregel1="adresregel1",
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="5001",
land="5001",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:organisatie-detail",
Expand All @@ -370,10 +371,10 @@ def test_update_organisatie(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
)
self.assertEqual(data["land"], "5001")
self.assertEqual(data["land"], "CA")

data = {
"handelsnaam": "changed",
Expand All @@ -384,9 +385,9 @@ def test_update_organisatie(self):
"adresregel1": "changed",
"adresregel2": "changed",
"adresregel3": "changed",
"land": "6713",
"land": "FR",
},
"land": "6713",
"land": "FR",
}
response = self.client.put(detail_url, data)
data = response.json()
Expand All @@ -400,10 +401,10 @@ def test_update_organisatie(self):
"adresregel1": "changed",
"adresregel2": "changed",
"adresregel3": "changed",
"land": "6713",
"land": "FR",
},
)
self.assertEqual(data["land"], "6713")
self.assertEqual(data["land"], "FR")

def test_update_partial_organisatie(self):
organisatie = OrganisatieFactory.create(
Expand All @@ -414,8 +415,8 @@ def test_update_partial_organisatie(self):
adres_adresregel1="adresregel1",
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="5001",
land="5001",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:organisatie-detail",
Expand All @@ -438,10 +439,10 @@ def test_update_partial_organisatie(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
)
self.assertEqual(data["land"], "5001")
self.assertEqual(data["land"], "CA")

data = {
"opheffingsdatum": "2023-11-22",
Expand All @@ -460,10 +461,10 @@ def test_update_partial_organisatie(self):
"adresregel1": "adresregel1",
"adresregel2": "adresregel2",
"adresregel3": "adresregel3",
"land": "5001",
"land": "CA",
},
)
self.assertEqual(data["land"], "5001")
self.assertEqual(data["land"], "CA")

def test_list_pagination_pagesize_param(self):
list_url = reverse("contactgegevens:organisatie-list")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class BezoekAdresDataFactory(factory.DictFactory):
adresregel1 = "adres1"
adresregel2 = "adres2"
adresregel3 = "adres3"
land = "6030"
land = "NL"


class CorrespondentieAdresDataFactory(factory.DictFactory):
nummeraanduidingId = "c06918d9-899b-4d98-a10d-08436ebc6c20"
adresregel1 = "adres1"
adresregel2 = "adres2"
adresregel3 = "adres3"
land = "6030"
land = "NL"


class ContactNaamDataFactory(factory.DictFactory):
Expand Down
Loading

0 comments on commit e442bb0

Please sign in to comment.