mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
replace behave BDD API tests with pytest-bdd tests
This commit is contained in:
56
test/bdd/features/api/reverse/geometry.feature
Normal file
56
test/bdd/features/api/reverse/geometry.feature
Normal file
@@ -0,0 +1,56 @@
|
||||
Feature: Geometries for reverse geocoding
|
||||
Tests for returning geometries with reverse
|
||||
|
||||
Scenario: Reverse - polygons are returned fully by default
|
||||
When sending v1/reverse
|
||||
| lat | lon | polygon_text |
|
||||
| 47.13803 | 9.52264 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| geotext!fm |
|
||||
| POLYGON\(\(9.5225302 47.138066, ?9.5225348 47.1379282, ?9.5226142 47.1379294, ?9.5226143 47.1379257, ?9.522615 47.137917, ?9.5226225 47.1379098, ?9.5226334 47.1379052, ?9.5226461 47.1379037, ?9.5226588 47.1379056, ?9.5226693 47.1379107, ?9.5226762 47.1379181, ?9.5226762 47.1379268, ?9.5226761 47.1379308, ?9.5227366 47.1379317, ?9.5227352 47.1379753, ?9.5227608 47.1379757, ?9.5227595 47.1380148, ?9.5227355 47.1380145, ?9.5227337 47.1380692, ?9.5225302 47.138066\)\) |
|
||||
|
||||
|
||||
Scenario: Reverse - polygons can be slightly simplified
|
||||
When sending v1/reverse
|
||||
| lat | lon | polygon_text | polygon_threshold |
|
||||
| 47.13803 | 9.52264 | 1 | 0.00001 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| geotext!fm |
|
||||
| POLYGON\(\(9.5225302 47.138066, ?9.5225348 47.1379282, ?9.5226142 47.1379294, ?9.5226225 47.1379098, ?9.5226588 47.1379056, ?9.5226761 47.1379308, ?9.5227366 47.1379317, ?9.5227352 47.1379753, ?9.5227608 47.1379757, ?9.5227595 47.1380148, ?9.5227355 47.1380145, ?9.5227337 47.1380692, ?9.5225302 47.138066\)\) |
|
||||
|
||||
|
||||
Scenario: Reverse - polygons can be much simplified
|
||||
When sending v1/reverse
|
||||
| lat | lon | polygon_text | polygon_threshold |
|
||||
| 47.13803 | 9.52264 | 1 | 0.9 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| geotext!fm |
|
||||
| POLYGON\(\([0-9. ]+, ?[0-9. ]+, ?[0-9. ]+, ?[0-9. ]+(, ?[0-9. ]+)?\)\) |
|
||||
|
||||
|
||||
Scenario: Reverse - for polygons return the centroid as center point
|
||||
When sending v1/reverse
|
||||
| lat | lon |
|
||||
| 47.13836 | 9.52304 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| lon | lat |
|
||||
| 9.5227108 | 47.1381805 |
|
||||
|
||||
|
||||
Scenario: Reverse - for streets return the closest point as center point
|
||||
When sending v1/reverse
|
||||
| lat | lon |
|
||||
| 47.13368 | 9.52942 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| lon | lat |
|
||||
| 9.5294315 | 47.1336817 |
|
||||
47
test/bdd/features/api/reverse/language.feature
Normal file
47
test/bdd/features/api/reverse/language.feature
Normal file
@@ -0,0 +1,47 @@
|
||||
Feature: Localization of reverse search results
|
||||
|
||||
Scenario: Reverse - default language
|
||||
When sending v1/reverse with format jsonv2
|
||||
| lat | lon |
|
||||
| 47.14 | 9.55 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| address+country |
|
||||
| Liechtenstein |
|
||||
|
||||
Scenario: Reverse - accept-language parameter
|
||||
When sending v1/reverse with format jsonv2
|
||||
| lat | lon | accept-language |
|
||||
| 47.14 | 9.55 | ja,en |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| address+country |
|
||||
| リヒテンシュタイン |
|
||||
|
||||
Scenario: Reverse - HTTP accept language header
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fo-ca,fo;q=0.8,en-ca;q=0.5,en;q=0.3 |
|
||||
When sending v1/reverse with format jsonv2
|
||||
| lat | lon |
|
||||
| 47.14 | 9.55 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| address+country |
|
||||
| Liktinstein |
|
||||
|
||||
Scenario: Reverse - accept-language parameter and HTTP header
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fo-ca,fo;q=0.8,en-ca;q=0.5,en;q=0.3 |
|
||||
When sending v1/reverse with format jsonv2
|
||||
| lat | lon | accept-language |
|
||||
| 47.14 | 9.55 | en |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| address+country |
|
||||
| Liechtenstein |
|
||||
75
test/bdd/features/api/reverse/layers.feature
Normal file
75
test/bdd/features/api/reverse/layers.feature
Normal file
@@ -0,0 +1,75 @@
|
||||
Feature: Layer parameter in reverse geocoding
|
||||
Testing correct function of layer selection while reverse geocoding
|
||||
|
||||
Scenario: POIs are selected by default
|
||||
When reverse geocoding 47.14077,9.52414
|
||||
Then the result contains
|
||||
| category | type |
|
||||
| tourism | viewpoint |
|
||||
|
||||
Scenario Outline: Same address level POI with different layers
|
||||
When reverse geocoding 47.14077,9.52414
|
||||
| layer |
|
||||
| <layer> |
|
||||
Then the result contains
|
||||
| category |
|
||||
| <category> |
|
||||
|
||||
Examples:
|
||||
| layer | category |
|
||||
| address | highway |
|
||||
| poi,address | tourism |
|
||||
| address,poi | tourism |
|
||||
| natural | waterway |
|
||||
| address,natural | highway |
|
||||
| natural,poi | tourism |
|
||||
|
||||
Scenario Outline: POIs are not selected without housenumber for address layer
|
||||
When reverse geocoding 47.13816,9.52168
|
||||
| layer |
|
||||
| <layer> |
|
||||
Then the result contains
|
||||
| category | type |
|
||||
| <category> | <type> |
|
||||
|
||||
Examples:
|
||||
| layer | category | type |
|
||||
| address,poi | highway | bus_stop |
|
||||
| address | amenity | parking |
|
||||
|
||||
Scenario: Between natural and low-zoom address prefer natural
|
||||
When reverse geocoding 47.13636,9.52094
|
||||
| layer | zoom |
|
||||
| natural,address | 15 |
|
||||
Then the result contains
|
||||
| category |
|
||||
| waterway |
|
||||
|
||||
Scenario Outline: Search for mountain peaks begins at level 12
|
||||
When reverse geocoding 47.08293,9.57109
|
||||
| layer | zoom |
|
||||
| natural | <zoom> |
|
||||
Then the result contains
|
||||
| category | type |
|
||||
| <category> | <type> |
|
||||
|
||||
Examples:
|
||||
| zoom | category | type |
|
||||
| 12 | natural | peak |
|
||||
| 13 | waterway | river |
|
||||
|
||||
Scenario Outline: Reverse search with manmade layers
|
||||
When reverse geocoding 32.46904,-86.44439
|
||||
| layer |
|
||||
| <layer> |
|
||||
Then the result contains
|
||||
| category | type |
|
||||
| <category> | <type> |
|
||||
|
||||
Examples:
|
||||
| layer | category | type |
|
||||
| manmade | leisure | park |
|
||||
| address | highway | residential |
|
||||
| poi | leisure | pitch |
|
||||
| natural | waterway | river |
|
||||
| natural,manmade | leisure | park |
|
||||
80
test/bdd/features/api/reverse/queries.feature
Normal file
80
test/bdd/features/api/reverse/queries.feature
Normal file
@@ -0,0 +1,80 @@
|
||||
Feature: Reverse geocoding
|
||||
Testing the reverse function
|
||||
|
||||
Scenario: Reverse - Unknown countries fall back to default country grid
|
||||
When reverse geocoding 45.174,-103.072
|
||||
Then the result contains
|
||||
| category | type | display_name |
|
||||
| place | country | United States |
|
||||
|
||||
Scenario: Reverse - No TIGER house number for zoom < 18
|
||||
When reverse geocoding 32.4752389363,-86.4810198619
|
||||
| zoom |
|
||||
| 17 |
|
||||
Then the result contains
|
||||
| osm_type | category |
|
||||
| way | highway |
|
||||
And the result contains in field address
|
||||
| road | postcode | country_code |
|
||||
| Upper Kingston Road | 36067 | us |
|
||||
|
||||
Scenario: Reverse - Address with non-numerical house number
|
||||
When reverse geocoding 47.107465,9.52838521614
|
||||
Then the result contains in field address
|
||||
| house_number | road |
|
||||
| 39A/B | Dorfstrasse |
|
||||
|
||||
Scenario: Reverse - Address with numerical house number
|
||||
When reverse geocoding 47.168440329479594,9.511551699184338
|
||||
Then the result contains in field address
|
||||
| house_number | road |
|
||||
| 6 | Schmedgässle |
|
||||
|
||||
Scenario Outline: Reverse - Zoom levels below 5 result in country
|
||||
When reverse geocoding 47.16,9.51
|
||||
| zoom |
|
||||
| <zoom> |
|
||||
Then the result contains
|
||||
| display_name |
|
||||
| Liechtenstein |
|
||||
|
||||
Examples:
|
||||
| zoom |
|
||||
| 0 |
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 3 |
|
||||
| 4 |
|
||||
|
||||
Scenario: Reverse - When on a street, the closest interpolation is shown
|
||||
When reverse geocoding 47.118457166193245,9.570678289621355
|
||||
| zoom |
|
||||
| 18 |
|
||||
Then the result contains
|
||||
| display_name |
|
||||
| 1021, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
|
||||
|
||||
# github 2214
|
||||
Scenario: Reverse - Interpolations do not override house numbers when they are closer
|
||||
When reverse geocoding 47.11778,9.57255
|
||||
| zoom |
|
||||
| 18 |
|
||||
Then the result contains
|
||||
| display_name |
|
||||
| 5, Grosssteg, Steg, Triesenberg, Oberland, 9497, Liechtenstein |
|
||||
|
||||
Scenario: Reverse - Interpolations do not override house numbers when they are closer (2)
|
||||
When reverse geocoding 47.11834,9.57167
|
||||
| zoom |
|
||||
| 18 |
|
||||
Then the result contains
|
||||
| display_name |
|
||||
| 3, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
|
||||
|
||||
Scenario: Reverse - When on a street with zoom 18, the closest housenumber is returned
|
||||
When reverse geocoding 47.11755503977281,9.572722250405036
|
||||
| zoom |
|
||||
| 18 |
|
||||
Then the result contains in field address
|
||||
| house_number |
|
||||
| 7 |
|
||||
143
test/bdd/features/api/reverse/v1_geocodejson.feature
Normal file
143
test/bdd/features/api/reverse/v1_geocodejson.feature
Normal file
@@ -0,0 +1,143 @@
|
||||
Feature: Geocodejson for Reverse API
|
||||
Testing correctness of geocodejson output (API version v1).
|
||||
|
||||
Scenario Outline: Reverse geocodejson - Simple with no results
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon |
|
||||
| <lat> | <lon> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| error |
|
||||
| Unable to geocode |
|
||||
|
||||
Examples:
|
||||
| lat | lon |
|
||||
| 0.0 | 0.0 |
|
||||
| 91.3 | 0.4 |
|
||||
| -700 | 0.4 |
|
||||
| 0.2 | 324.44 |
|
||||
| 0.2 | -180.4 |
|
||||
|
||||
Scenario Outline: Reverse geocodejson - Simple OSM result
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon | addressdetails |
|
||||
| 47.066 | 9.504 | <has_address> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And the result metadata contains
|
||||
| version | licence | attribution!fm |
|
||||
| 0.1.0 | ODbL | Data © OpenStreetMap contributors, ODbL 1.0. https?://osm.org/copyright |
|
||||
And all results have <attributes> country,postcode,county,city,district,street,housenumber,admin
|
||||
And all results contain
|
||||
| param | value |
|
||||
| osm_type | node |
|
||||
| osm_id | 6522627624 |
|
||||
| osm_key | shop |
|
||||
| osm_value | bakery |
|
||||
| type | house |
|
||||
| name | Dorfbäckerei Herrmann |
|
||||
| label | Dorfbäckerei Herrmann, 29, Gnetsch, Mäls, Balzers, Oberland, 9496, Liechtenstein |
|
||||
| geojson+type | Point |
|
||||
| geojson+coordinates | [9.5036065, 47.0660892] |
|
||||
|
||||
Examples:
|
||||
| has_address | attributes |
|
||||
| 1 | attributes |
|
||||
| 0 | no attributes |
|
||||
|
||||
Scenario: Reverse geocodejson - City housenumber-level address with street
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon |
|
||||
| 47.1068011 | 9.52810091 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And all results contain
|
||||
| housenumber | street | postcode | city | country |
|
||||
| 8 | Im Winkel | 9495 | Triesen | Liechtenstein |
|
||||
And all results contain
|
||||
| admin+level6 | admin+level8 |
|
||||
| Oberland | Triesen |
|
||||
|
||||
Scenario: Reverse geocodejson - Town street-level address with street
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon | zoom |
|
||||
| 47.066 | 9.504 | 16 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And all results contain
|
||||
| name | city | postcode | country |
|
||||
| Gnetsch | Balzers | 9496 | Liechtenstein |
|
||||
|
||||
Scenario: Reverse geocodejson - Poi street-level address with footway
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon |
|
||||
| 47.06515 | 9.50083 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And all results contain
|
||||
| street | city | postcode | country |
|
||||
| Burgweg | Balzers | 9496 | Liechtenstein |
|
||||
|
||||
Scenario: Reverse geocodejson - City address with suburb
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon |
|
||||
| 47.146861 | 9.511771 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And all results contain
|
||||
| housenumber | street | district | city | postcode | country |
|
||||
| 5 | Lochgass | Ebenholz | Vaduz | 9490 | Liechtenstein |
|
||||
|
||||
Scenario: Reverse geocodejson - Tiger address
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon |
|
||||
| 32.4752389363 | -86.4810198619 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And all results contain
|
||||
| osm_type | osm_id | osm_key | osm_value | type |
|
||||
| way | 396009653 | place | house | house |
|
||||
And all results contain
|
||||
| housenumber | street | city | county | postcode | country |
|
||||
| 707 | Upper Kingston Road | Prattville | Autauga County | 36067 | United States |
|
||||
|
||||
Scenario: Reverse geocodejson - Interpolation address
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon |
|
||||
| 47.118533 | 9.57056562 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And all results contain
|
||||
| osm_type | osm_id | osm_key | osm_value | type |
|
||||
| way | 1 | place | house | house |
|
||||
And all results contain
|
||||
| label |
|
||||
| 1019, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
|
||||
And all results have no attributes name
|
||||
|
||||
Scenario: Reverse geocodejson - Line geometry output is supported
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon | polygon_geojson |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And all results contain
|
||||
| geojson+type |
|
||||
| LineString |
|
||||
|
||||
Scenario Outline: Reverse geocodejson - Only geojson polygons are supported
|
||||
When sending v1/reverse with format geocodejson
|
||||
| lat | lon | <param> |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson with 1 result
|
||||
And all results contain
|
||||
| geojson+type |
|
||||
| Point |
|
||||
|
||||
Examples:
|
||||
| param |
|
||||
| polygon_text |
|
||||
| polygon_svg |
|
||||
| polygon_kml |
|
||||
102
test/bdd/features/api/reverse/v1_geojson.feature
Normal file
102
test/bdd/features/api/reverse/v1_geojson.feature
Normal file
@@ -0,0 +1,102 @@
|
||||
Feature: Geojson for Reverse API
|
||||
Testing correctness of geojson output (API version v1).
|
||||
|
||||
Scenario Outline: Reverse geojson - Simple with no results
|
||||
When sending v1/reverse with format geojson
|
||||
| lat | lon |
|
||||
| <lat> | <lon> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| error |
|
||||
| Unable to geocode |
|
||||
|
||||
Examples:
|
||||
| lat | lon |
|
||||
| 0.0 | 0.0 |
|
||||
| 91.3 | 0.4 |
|
||||
| -700 | 0.4 |
|
||||
| 0.2 | 324.44 |
|
||||
| 0.2 | -180.4 |
|
||||
|
||||
Scenario Outline: Reverse geojson - Simple OSM result
|
||||
When sending v1/reverse with format geojson
|
||||
| lat | lon | addressdetails |
|
||||
| 47.066 | 9.504 | <has_address> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geojson with 1 result
|
||||
And the result metadata contains
|
||||
| licence!fm |
|
||||
| Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright |
|
||||
And all results have attributes place_id, importance
|
||||
And all results have <attributes> address
|
||||
And all results contain
|
||||
| param | value |
|
||||
| osm_type | node |
|
||||
| osm_id | 6522627624 |
|
||||
| place_rank | 30 |
|
||||
| category | shop |
|
||||
| type | bakery |
|
||||
| addresstype | shop |
|
||||
| name | Dorfbäckerei Herrmann |
|
||||
| display_name | Dorfbäckerei Herrmann, 29, Gnetsch, Mäls, Balzers, Oberland, 9496, Liechtenstein |
|
||||
| boundingbox | [47.0660392, 47.0661392, 9.5035565, 9.5036565] |
|
||||
| geojson+type | Point |
|
||||
| geojson+coordinates | [9.5036065, 47.0660892] |
|
||||
|
||||
Examples:
|
||||
| has_address | attributes |
|
||||
| 1 | attributes |
|
||||
| 0 | no attributes |
|
||||
|
||||
Scenario: Reverse geojson - Tiger address
|
||||
When sending v1/reverse with format geojson
|
||||
| lat | lon |
|
||||
| 32.4752389363 | -86.4810198619 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geojson with 1 result
|
||||
And all results contain
|
||||
| osm_type | osm_id | category | type | addresstype | place_rank |
|
||||
| way | 396009653 | place | house | place | 30 |
|
||||
|
||||
Scenario: Reverse geojson - Interpolation address
|
||||
When sending v1/reverse with format geojson
|
||||
| lat | lon |
|
||||
| 47.118533 | 9.57056562 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geojson with 1 result
|
||||
And all results contain
|
||||
| osm_type | osm_id | place_rank | category | type | addresstype |
|
||||
| way | 1 | 30 | place | house | place |
|
||||
And all results contain
|
||||
| boundingbox!in_box |
|
||||
| 47.118494, 47.118596, 9.570495, 9.570597 |
|
||||
And all results contain
|
||||
| display_name |
|
||||
| 1019, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
|
||||
|
||||
Scenario: Reverse geojson - Line geometry output is supported
|
||||
When sending v1/reverse with format geojson
|
||||
| lat | lon | polygon_geojson |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geojson with 1 result
|
||||
And all results contain
|
||||
| geojson+type |
|
||||
| LineString |
|
||||
|
||||
Scenario Outline: Reverse geojson - Only geojson polygons are supported
|
||||
When sending v1/reverse with format geojson
|
||||
| lat | lon | <param> |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geojson with 1 result
|
||||
And all results contain
|
||||
| geojson+type |
|
||||
| Point |
|
||||
|
||||
Examples:
|
||||
| param |
|
||||
| polygon_text |
|
||||
| polygon_svg |
|
||||
| polygon_kml |
|
||||
175
test/bdd/features/api/reverse/v1_json.feature
Normal file
175
test/bdd/features/api/reverse/v1_json.feature
Normal file
@@ -0,0 +1,175 @@
|
||||
Feature: Json output for Reverse API
|
||||
Testing correctness of json and jsonv2 output (API version v1).
|
||||
|
||||
Scenario Outline: Reverse json - Simple with no results
|
||||
When sending v1/reverse with format json
|
||||
| lat | lon |
|
||||
| <lat> | <lon> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| error |
|
||||
| Unable to geocode |
|
||||
When sending v1/reverse with format jsonv2
|
||||
| lat | lon |
|
||||
| <lat> | <lon> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| error |
|
||||
| Unable to geocode |
|
||||
|
||||
Examples:
|
||||
| lat | lon |
|
||||
| 0.0 | 0.0 |
|
||||
| 91.3 | 0.4 |
|
||||
| -700 | 0.4 |
|
||||
| 0.2 | 324.44 |
|
||||
| 0.2 | -180.4 |
|
||||
|
||||
Scenario Outline: Reverse json - OSM result with and without addresses
|
||||
When sending v1/reverse with format json
|
||||
| lat | lon | addressdetails |
|
||||
| 47.066 | 9.504 | <has_address> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has <attributes> address
|
||||
When sending v1/reverse with format jsonv2
|
||||
| lat | lon | addressdetails |
|
||||
| 47.066 | 9.504 | <has_address> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has <attributes> address
|
||||
|
||||
Examples:
|
||||
| has_address | attributes |
|
||||
| 1 | attributes |
|
||||
| 0 | no attributes |
|
||||
|
||||
Scenario Outline: Reverse json - Simple OSM result
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon |
|
||||
| 47.066 | 9.504 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes place_id
|
||||
And the result contains
|
||||
| licence!fm |
|
||||
| Data © OpenStreetMap contributors, ODbL 1.0. https?://osm.org/copyright |
|
||||
And the result contains
|
||||
| osm_type | osm_id |
|
||||
| node | 6522627624 |
|
||||
And the result contains
|
||||
| lon | lat | boundingbox!in_box |
|
||||
| 9.5036065 | 47.0660892 | 47.0660391, 47.0661393, 9.5035564, 9.5036566 |
|
||||
And the result contains
|
||||
| display_name |
|
||||
| Dorfbäckerei Herrmann, 29, Gnetsch, Mäls, Balzers, Oberland, 9496, Liechtenstein |
|
||||
And the result has no attributes namedetails,extratags
|
||||
|
||||
Examples:
|
||||
| format |
|
||||
| json |
|
||||
| jsonv2 |
|
||||
|
||||
Scenario: Reverse json - Extra attributes of jsonv2 result
|
||||
When sending v1/reverse with format jsonv2
|
||||
| lat | lon |
|
||||
| 47.066 | 9.504 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes importance
|
||||
And the result contains
|
||||
| category | type | name | place_rank | addresstype |
|
||||
| shop | bakery | Dorfbäckerei Herrmann | 30 | shop |
|
||||
|
||||
Scenario: Reverse json - Tiger address
|
||||
When sending v1/reverse with format jsonv2
|
||||
| lat | lon |
|
||||
| 32.4752389363 | -86.4810198619 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| osm_type | osm_id | category | type | addresstype |
|
||||
| way | 396009653 | place | house | place |
|
||||
|
||||
Scenario Outline: Reverse json - Interpolation address
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon |
|
||||
| 47.118533 | 9.57056562 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| osm_type | osm_id |
|
||||
| way | 1 |
|
||||
And the result contains
|
||||
| lon | lat | boundingbox!in_box |
|
||||
| 9.5705468 | 47.1185454 | 47.118494, 47.118596, 9.570495, 9.570597 |
|
||||
And the result contains
|
||||
| display_name |
|
||||
| 1019, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
|
||||
|
||||
Examples:
|
||||
| format |
|
||||
| json |
|
||||
| jsonv2 |
|
||||
|
||||
Scenario Outline: Reverse json - Output of geojson
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon | polygon_geojson |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| geojson+type | geojson+coordinates |
|
||||
| LineString | [[9.5039353, 47.0657546], [9.5040437, 47.0657781], [9.5040808, 47.065787], [9.5054298, 47.0661407]] |
|
||||
|
||||
Examples:
|
||||
| format |
|
||||
| json |
|
||||
| jsonv2 |
|
||||
|
||||
Scenario Outline: Reverse json - Output of WKT
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon | polygon_text |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| geotext!fm |
|
||||
| LINESTRING\(9.5039353 47.0657546, ?9.5040437 47.0657781, ?9.5040808 47.065787, ?9.5054298 47.0661407\) |
|
||||
|
||||
Examples:
|
||||
| format |
|
||||
| json |
|
||||
| jsonv2 |
|
||||
|
||||
Scenario Outline: Reverse json - Output of SVG
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon | polygon_svg |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| svg |
|
||||
| M 9.5039353 -47.0657546 L 9.5040437 -47.0657781 9.5040808 -47.065787 9.5054298 -47.0661407 |
|
||||
|
||||
Examples:
|
||||
| format |
|
||||
| json |
|
||||
| jsonv2 |
|
||||
|
||||
Scenario Outline: Reverse json - Output of KML
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon | polygon_kml |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| geokml!fm |
|
||||
| <LineString><coordinates>9.5039\d*,47.0657\d* 9.5040\d*,47.0657\d* 9.5040\d*,47.065\d* 9.5054\d*,47.0661\d*</coordinates></LineString> |
|
||||
|
||||
Examples:
|
||||
| format |
|
||||
| json |
|
||||
| jsonv2 |
|
||||
169
test/bdd/features/api/reverse/v1_params.feature
Normal file
169
test/bdd/features/api/reverse/v1_params.feature
Normal file
@@ -0,0 +1,169 @@
|
||||
Feature: v1/reverse Parameter Tests
|
||||
Tests for parameter inputs for the v1 reverse endpoint.
|
||||
This file contains mostly bad parameter input. Valid parameters
|
||||
are tested in the format tests.
|
||||
|
||||
Scenario: Bad format
|
||||
When sending v1/reverse
|
||||
| lat | lon | format |
|
||||
| 47.14122383 | 9.52169581334 | sdf |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Scenario: Missing lon parameter
|
||||
When sending v1/reverse
|
||||
| lat |
|
||||
| 52.52 |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Scenario: Missing lat parameter
|
||||
When sending v1/reverse
|
||||
| lon |
|
||||
| 52.52 |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Scenario Outline: Bad format for lat or lon
|
||||
When sending v1/reverse
|
||||
| lat | lon |
|
||||
| <lat> | <lon> |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Examples:
|
||||
| lat | lon |
|
||||
| 48.9660 | 8,4482 |
|
||||
| 48,9660 | 8.4482 |
|
||||
| 48,9660 | 8,4482 |
|
||||
| 48.966.0 | 8.4482 |
|
||||
| 48.966 | 8.448.2 |
|
||||
| Nan | 8.448 |
|
||||
| 48.966 | Nan |
|
||||
| Inf | 5.6 |
|
||||
| 5.6 | -Inf |
|
||||
| <script></script> | 3.4 |
|
||||
| 3.4 | <script></script> |
|
||||
| -45.3 | ; |
|
||||
| gkjd | 50 |
|
||||
|
||||
Scenario: Non-numerical zoom levels return an error
|
||||
When sending v1/reverse
|
||||
| lat | lon | zoom |
|
||||
| 47.14122383 | 9.52169581334 | adfe |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Scenario Outline: Truthy values for boolean parameters
|
||||
When sending v1/reverse
|
||||
| lat | lon | addressdetails |
|
||||
| 47.14122383 | 9.52169581334 | <value> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result has attributes address
|
||||
|
||||
When sending v1/reverse
|
||||
| lat | lon | extratags |
|
||||
| 47.14122383 | 9.52169581334 | <value> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result has attributes extratags
|
||||
|
||||
When sending v1/reverse
|
||||
| lat | lon | namedetails |
|
||||
| 47.14122383 | 9.52169581334 | <value> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result has attributes namedetails
|
||||
|
||||
Examples:
|
||||
| value |
|
||||
| yes |
|
||||
| no |
|
||||
| -1 |
|
||||
| 100 |
|
||||
| false |
|
||||
| 00 |
|
||||
|
||||
Scenario: Only one geometry can be requested
|
||||
When sending v1/reverse
|
||||
| lat | lon | polygon_text | polygon_svg |
|
||||
| 47.14122383 | 9.52169581334 | 1 | 1 |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Scenario Outline: Illegal jsonp are not allowed
|
||||
When sending v1/reverse with format json
|
||||
| lat | lon | json_callback |
|
||||
| 47.14122383 | 9.52169581334 | <data> |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Examples:
|
||||
| data |
|
||||
| 1asd |
|
||||
| bar(foo) |
|
||||
| XXX['bad'] |
|
||||
| foo; evil |
|
||||
|
||||
Scenario Outline: Reverse debug mode produces valid HTML
|
||||
When sending v1/reverse
|
||||
| lat | lon | debug |
|
||||
| <lat> | <lon> | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid html
|
||||
|
||||
Examples:
|
||||
| lat | lon |
|
||||
| 0.0 | 0.0 |
|
||||
| 47.06645 | 9.56601 |
|
||||
| 47.14081 | 9.52267 |
|
||||
|
||||
Scenario Outline: Full address display for city housenumber-level address with street
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon |
|
||||
| 47.1068011 | 9.52810091 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And the result contains in field address
|
||||
| param | value |
|
||||
| house_number | 8 |
|
||||
| road | Im Winkel |
|
||||
| neighbourhood | Oberdorf |
|
||||
| village | Triesen |
|
||||
| ISO3166-2-lvl8 | LI-09 |
|
||||
| county | Oberland |
|
||||
| postcode | 9495 |
|
||||
| country | Liechtenstein |
|
||||
| country_code | li |
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| xml | xml |
|
||||
|
||||
Scenario Outline: Results with name details
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon | zoom | namedetails |
|
||||
| 47.14052 | 9.52202 | 14 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And the result contains in field namedetails
|
||||
| name |
|
||||
| Ebenholz |
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| xml | xml |
|
||||
|
||||
Scenario Outline: Results with extratags
|
||||
When sending v1/reverse with format <format>
|
||||
| lat | lon | zoom | extratags |
|
||||
| 47.14052 | 9.52202 | 14 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And the result contains in field extratags
|
||||
| wikidata |
|
||||
| Q4529531 |
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| xml | xml |
|
||||
116
test/bdd/features/api/reverse/v1_xml.feature
Normal file
116
test/bdd/features/api/reverse/v1_xml.feature
Normal file
@@ -0,0 +1,116 @@
|
||||
Feature: XML output for Reverse API
|
||||
Testing correctness of xml output (API version v1).
|
||||
|
||||
Scenario Outline: Reverse XML - Simple reverse-geocoding with no results
|
||||
When sending v1/reverse
|
||||
| lat | lon |
|
||||
| <lat> | <lon> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result has no attributes osm_type, address, extratags
|
||||
And the result contains
|
||||
| error |
|
||||
| Unable to geocode |
|
||||
|
||||
Examples:
|
||||
| lat | lon |
|
||||
| 0.0 | 0.0 |
|
||||
| 91.3 | 0.4 |
|
||||
| -700 | 0.4 |
|
||||
| 0.2 | 324.44 |
|
||||
| 0.2 | -180.4 |
|
||||
|
||||
Scenario Outline: Reverse XML - OSM result with and without addresses
|
||||
When sending v1/reverse with format xml
|
||||
| lat | lon | addressdetails |
|
||||
| 47.066 | 9.504 | <has_address> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result has attributes place_id
|
||||
And the result has <attributes> address
|
||||
And the result contains
|
||||
| osm_type | osm_id | place_rank | address_rank |
|
||||
| node | 6522627624 | 30 | 30 |
|
||||
And the result contains
|
||||
| lon | lat | boundingbox |
|
||||
| 9.5036065 | 47.0660892 | 47.0660392,47.0661392,9.5035565,9.5036565 |
|
||||
And the result contains
|
||||
| ref | display_name |
|
||||
| Dorfbäckerei Herrmann | Dorfbäckerei Herrmann, 29, Gnetsch, Mäls, Balzers, Oberland, 9496, Liechtenstein |
|
||||
|
||||
Examples:
|
||||
| has_address | attributes |
|
||||
| 1 | attributes |
|
||||
| 0 | no attributes |
|
||||
|
||||
Scenario: Reverse XML - Tiger address
|
||||
When sending v1/reverse with format xml
|
||||
| lat | lon |
|
||||
| 32.4752389363 | -86.4810198619 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| osm_type | osm_id | place_rank | address_rank |
|
||||
| way | 396009653 | 30 | 30 |
|
||||
And the result contains
|
||||
| lon | lat | boundingbox |
|
||||
| -86.4808553 | 32.4753580 | 32.4753080,32.4754080,-86.4809053,-86.4808053 |
|
||||
And the result contains
|
||||
| display_name |
|
||||
| 707, Upper Kingston Road, Upper Kingston, Prattville, Autauga County, 36067, United States |
|
||||
|
||||
Scenario: Reverse XML - Interpolation address
|
||||
When sending v1/reverse with format xml
|
||||
| lat | lon |
|
||||
| 47.118533 | 9.57056562 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| osm_type | osm_id | place_rank | address_rank |
|
||||
| way | 1 | 30 | 30 |
|
||||
And the result contains
|
||||
| lon | lat | boundingbox |
|
||||
| 9.5705468 | 47.1185454 | 47.1184954,47.1185954,9.5704968,9.5705968 |
|
||||
And the result contains
|
||||
| display_name |
|
||||
| 1019, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
|
||||
|
||||
Scenario: Reverse XML - Output of geojson
|
||||
When sending v1/reverse with format xml
|
||||
| lat | lon | polygon_geojson |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| geojson |
|
||||
| {"type":"LineString","coordinates":[[9.5039353,47.0657546],[9.5040437,47.0657781],[9.5040808,47.065787],[9.5054298,47.0661407]]} |
|
||||
|
||||
Scenario: Reverse XML - Output of WKT
|
||||
When sending v1/reverse with format xml
|
||||
| lat | lon | polygon_text |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| geotext!fm |
|
||||
| LINESTRING\(9.5039353 47.0657546, ?9.5040437 47.0657781, ?9.5040808 47.065787, ?9.5054298 47.0661407\) |
|
||||
|
||||
Scenario: Reverse XML - Output of SVG
|
||||
When sending v1/reverse with format xml
|
||||
| lat | lon | polygon_svg |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| geosvg |
|
||||
| M 9.5039353 -47.0657546 L 9.5040437 -47.0657781 9.5040808 -47.065787 9.5054298 -47.0661407 |
|
||||
|
||||
Scenario: Reverse XML - Output of KML
|
||||
When sending v1/reverse with format xml
|
||||
| lat | lon | polygon_kml |
|
||||
| 47.06597 | 9.50467 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result contains
|
||||
| geokml!fm |
|
||||
| <geokml><LineString><coordinates>9.5039\d*,47.0657\d* 9.5040\d*,47.0657\d* 9.5040\d*,47.065\d* 9.5054\d*,47.0661\d*</coordinates></LineString></geokml> |
|
||||
Reference in New Issue
Block a user