Skip to content

Commit

Permalink
new test cases for optionnal params
Browse files Browse the repository at this point in the history
  • Loading branch information
antosomzi committed May 14, 2024
1 parent b697159 commit fb45fa5
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion tests/test_geocoder_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,53 @@ def test_addresswithdetails_whensucceed(self):
expectedResponse,
status=200,
)
response = self._api.address_with_details(34, "Barbaros", "Istanbul", "Turkey")
response = self._api.address_with_details(
street="Barbaros",
city="Istanbul",
country="Turkey",
house_number=34
)
self.assertTrue(response)
self.assertIsInstance(response, herepy.GeocoderResponse)

@responses.activate
def test_address_with_detail_without_street(self):
with open("testdata/models/geocoder.json", "r") as f:
expected_response = f.read()
responses.add(
responses.GET,
"https://geocode.search.hereapi.com/v1/geocode",
expected_response,
status=200,
)
response = self._api.address_with_details(
city="Istanbul",
country="Turkey",
house_number=34,
street= None
)
self.assertTrue(response)
self.assertIsInstance(response, herepy.GeocoderResponse)

@responses.activate
def test_address_with_detail_without_house_number(self):
with open("testdata/models/geocoder.json", "r") as f:
expected_response = f.read()
responses.add(
responses.GET,
"https://geocode.search.hereapi.com/v1/geocode",
expected_response,
status=200,
)
response = self._api.address_with_details(
street="Barbaros",
city="Istanbul",
country="Turkey",
house_number= None
)
self.assertTrue(response)
self.assertIsInstance(response, herepy.GeocoderResponse)

@responses.activate
def test_addresswithdetails_whenerroroccurred(self):
with open("testdata/models/geocoder_error.json", "r") as f:
Expand Down

0 comments on commit fb45fa5

Please sign in to comment.