mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
add tests for geocodejson address fields
This commit is contained in:
27
test/bdd/api/reverse/geocodejson.feature
Normal file
27
test/bdd/api/reverse/geocodejson.feature
Normal file
@@ -0,0 +1,27 @@
|
||||
@APIDB
|
||||
Feature: Parameters for Reverse API
|
||||
Testing correctness of geocodejson output.
|
||||
|
||||
Scenario: City housenumber-level address with street
|
||||
When sending geocodejson reverse coordinates 53.556,9.9607
|
||||
Then results contain
|
||||
| housenumber | street | postcode | city | country |
|
||||
| 10 | Brunnenhofstraße | 22767 | Hamburg | Deutschland |
|
||||
|
||||
Scenario: Town street-level address with street
|
||||
When sending geocodejson reverse coordinates 47.066,9.504
|
||||
Then results contain
|
||||
| street | city | postcode | country |
|
||||
| Gnetsch | Balzers | 9496 | Liechtenstein |
|
||||
|
||||
Scenario: Town street-level address with footway
|
||||
When sending geocodejson reverse coordinates 47.0653,9.5007
|
||||
Then results contain
|
||||
| street | city | postcode | country |
|
||||
| Burgweg | Balzers | 9496 | Liechtenstein |
|
||||
|
||||
Scenario: City address with suburb
|
||||
When sending geocodejson reverse coordinates 53.5822,10.0805
|
||||
Then results contain
|
||||
| housenumber | street | locality | city | postcode | country |
|
||||
| 64 | Hinschenfelder Straße | Wandsbek | Hamburg | 22047 | Deutschland |
|
||||
27
test/bdd/api/search/geocodejson.feature
Normal file
27
test/bdd/api/search/geocodejson.feature
Normal file
@@ -0,0 +1,27 @@
|
||||
@APIDB
|
||||
Feature: Parameters for Search API
|
||||
Testing correctness of geocodejson output.
|
||||
|
||||
Scenario: City housenumber-level address with street
|
||||
When sending geocodejson search query "Brunnenhofstr 10, Hamburg" with address
|
||||
Then results contain
|
||||
| housenumber | street | postcode | city | country |
|
||||
| 10 | Brunnenhofstraße | 22767 | Hamburg | Deutschland |
|
||||
|
||||
Scenario: Town street-level address with street
|
||||
When sending geocodejson search query "Gnetsch, Balzers" with address
|
||||
Then results contain
|
||||
| street | city | postcode | country |
|
||||
| Gnetsch | Balzers | 9496 | Liechtenstein |
|
||||
|
||||
Scenario: Town street-level address with footway
|
||||
When sending geocodejson search query "burg gutenberg 6000 jahre geschichte" with address
|
||||
Then results contain
|
||||
| street | city | postcode | country |
|
||||
| Burgweg | Balzers | 9496 | Liechtenstein |
|
||||
|
||||
Scenario: City address with suburb
|
||||
When sending geocodejson search query "hinschenfelder str 64, wandsbek" with address
|
||||
Then results contain
|
||||
| housenumber | street | locality | city | postcode | country |
|
||||
| 64 | Hinschenfelder Straße | Wandsbek | Hamburg | 22047 | Deutschland |
|
||||
@@ -115,7 +115,9 @@ class SearchResponse(GenericResponse):
|
||||
self.result = geojson_results_to_json_results(self.result)
|
||||
|
||||
def parse_geocodejson(self):
|
||||
return self.parse_geojson()
|
||||
self.parse_geojson()
|
||||
if self.result is not None:
|
||||
self.result = [r['geocoding'] for r in self.result]
|
||||
|
||||
def parse_html(self):
|
||||
content, errors = tidy_document(self.page,
|
||||
@@ -203,7 +205,9 @@ class ReverseResponse(GenericResponse):
|
||||
self.result = geojson_results_to_json_results(self.result[0])
|
||||
|
||||
def parse_geocodejson(self):
|
||||
return self.parse_geojson()
|
||||
self.parse_geojson()
|
||||
if self.result is not None:
|
||||
self.result = [r['geocoding'] for r in self.result]
|
||||
|
||||
def parse_xml(self):
|
||||
et = ET.fromstring(self.page)
|
||||
|
||||
Reference in New Issue
Block a user