Skip to content

Commit

Permalink
fix: update mock data huisnummer and add type description for address…
Browse files Browse the repository at this point in the history
… model tests
  • Loading branch information
remyvdwereld committed Nov 22, 2024
1 parent b32283b commit 2356678
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/apps/addresses/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def mock_get_bag_identificatie_and_stadsdeel_result_without_stadsdeel():
"_embedded": {
"adresseerbareobjecten": [
{
"huisnummer": 42,
"huisnummer": 1,
"identificatie": "123456789"
# No "gebiedenStadsdeelNaam" key
}
Expand All @@ -76,8 +76,9 @@ def mock_get_bag_identificatie_and_stadsdeel_result():
"adresseerbareobjecten": [
{
"identificatie": "123456789",
"huisnummer": 42,
"huisnummer": 1,
"gebiedenStadsdeelNaam": "Zuidoost",
"typeAdresseerbaarObjectOmschrijving": "verblijfsobject",
}
]
}
Expand Down
6 changes: 4 additions & 2 deletions app/apps/addresses/tests/tests_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_can_create_address_with_bag_result_without_stadsdeel(
@patch("apps.addresses.models.do_bag_search_benkagg_by_id")
@patch("apps.addresses.models.do_bag_search_pdok_by_bag_id")
def test_can_create_address_with_bag_result(
self, mock_do_bag_search_benkagg_id, mock_do_bag_search_pdok_by_bag_id
self, mock_do_bag_search_pdok_by_bag_id, mock_do_bag_search_benkagg_id
):
"""Tests Address object creation with bag data mocks"""

Expand All @@ -65,10 +65,12 @@ def test_can_create_address_with_bag_result(
self.assertEquals(Address.objects.count(), 0)
self.assertEquals(District.objects.count(), 0)

baker.make(Address)
address = baker.make(Address)

mock_do_bag_search_pdok_by_bag_id.assert_called()
mock_do_bag_search_benkagg_id.assert_called()

self.assertEquals(Address.objects.count(), 1)
self.assertEquals(District.objects.count(), 1)

self.assertEquals(address.district.name, "Zuidoost")

0 comments on commit 2356678

Please sign in to comment.