@@ -94,7 +94,8 @@ def test_addresswithdetails_whensucceed(self):
94
94
street = "Barbaros" ,
95
95
city = "Istanbul" ,
96
96
country = "Turkey" ,
97
- house_number = 34
97
+ house_number = 34 ,
98
+ postal_code = "34353" ,
98
99
)
99
100
self .assertTrue (response )
100
101
self .assertIsInstance (response , herepy .GeocoderResponse )
@@ -136,7 +137,54 @@ def test_address_with_detail_without_house_number(self):
136
137
)
137
138
self .assertTrue (response )
138
139
self .assertIsInstance (response , herepy .GeocoderResponse )
139
-
140
+
141
+ @responses .activate
142
+ def test_address_with_detail_without_country (self ):
143
+ with open ("testdata/models/geocoder.json" , "r" ) as f :
144
+ expected_response = f .read ()
145
+ responses .add (
146
+ responses .GET ,
147
+ "https://geocode.search.hereapi.com/v1/geocode" ,
148
+ expected_response ,
149
+ status = 200 ,
150
+ )
151
+ response = self ._api .address_with_details (
152
+ street = "Barbaros" ,
153
+ city = "Istanbul" ,
154
+ country = None
155
+ )
156
+ self .assertTrue (response )
157
+ self .assertIsInstance (response , herepy .GeocoderResponse )
158
+
159
+ @responses .activate
160
+ def test_address_with_detail_with_only_country (self ):
161
+ with open ("testdata/models/geocoder.json" ) as f :
162
+ expected_response = f .read ()
163
+ responses .add (
164
+ responses .GET ,
165
+ "https://geocode.search.hereapi.com/v1/geocode" ,
166
+ expected_response ,
167
+ status = 200 ,
168
+ )
169
+ response = self ._api .address_with_details (
170
+ country = "FR" ,
171
+ )
172
+ self .assertTrue (response )
173
+ self .assertIsInstance (response , herepy .GeocoderResponse )
174
+
175
+ @responses .activate
176
+ def test_address_with_detail_without_any_detail_raise (self ):
177
+ with open ("testdata/models/geocoder.json" ) as f :
178
+ expected_response = f .read ()
179
+ responses .add (
180
+ responses .GET ,
181
+ "https://geocode.search.hereapi.com/v1/geocode" ,
182
+ expected_response ,
183
+ status = 200 ,
184
+ )
185
+ with self .assertRaises (herepy .HEREError ):
186
+ self ._api .address_with_details ()
187
+
140
188
@responses .activate
141
189
def test_addresswithdetails_whenerroroccurred (self ):
142
190
with open ("testdata/models/geocoder_error.json" , "r" ) as f :
0 commit comments