mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
replace behave BDD API tests with pytest-bdd tests
This commit is contained in:
83
test/bdd/features/api/details/language.feature
Normal file
83
test/bdd/features/api/details/language.feature
Normal file
@@ -0,0 +1,83 @@
|
||||
Feature: Localization of search results
|
||||
|
||||
Scenario: default language
|
||||
When sending v1/details
|
||||
| osmtype | osmid |
|
||||
| R | 1155955 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| localname |
|
||||
| Liechtenstein |
|
||||
|
||||
Scenario: accept-language first
|
||||
When sending v1/details
|
||||
| osmtype | osmid | accept-language |
|
||||
| R | 1155955 | zh,de |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| localname |
|
||||
| 列支敦士登 |
|
||||
|
||||
Scenario: accept-language missing
|
||||
When sending v1/details
|
||||
| osmtype | osmid | accept-language |
|
||||
| R | 1155955 | xx,fr,en,de |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| localname |
|
||||
| Liechtenstein |
|
||||
|
||||
Scenario: http accept language header first
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fo;q=0.8,en-ca;q=0.5,en;q=0.3 |
|
||||
When sending v1/details
|
||||
| osmtype | osmid |
|
||||
| R | 1155955 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| localname |
|
||||
| Liktinstein |
|
||||
|
||||
Scenario: http accept language header and accept-language
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fr-ca,fr;q=0.8,en-ca;q=0.5,en;q=0.3 |
|
||||
When sending v1/details
|
||||
| osmtype | osmid | accept-language |
|
||||
| R | 1155955 | fo,en |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| localname |
|
||||
| Liktinstein |
|
||||
|
||||
Scenario: http accept language header fallback
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fo-ca,en-ca;q=0.5 |
|
||||
When sending v1/details
|
||||
| osmtype | osmid |
|
||||
| R | 1155955 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| localname |
|
||||
| Liktinstein |
|
||||
|
||||
Scenario: http accept language header fallback (upper case)
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fo-FR;q=0.8,en-ca;q=0.5 |
|
||||
When sending v1/details
|
||||
| osmtype | osmid |
|
||||
| R | 1155955 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| localname |
|
||||
| Liktinstein |
|
||||
99
test/bdd/features/api/details/params.feature
Normal file
99
test/bdd/features/api/details/params.feature
Normal file
@@ -0,0 +1,99 @@
|
||||
Feature: Object details
|
||||
Testing different parameter options for details API.
|
||||
|
||||
Scenario: Basic details
|
||||
When sending v1/details
|
||||
| osmtype | osmid |
|
||||
| W | 297699560 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes geometry
|
||||
And the result has no attributes keywords,address,linked_places,parentof
|
||||
And the result contains
|
||||
| geometry+type |
|
||||
| Point |
|
||||
|
||||
Scenario: Basic details with pretty printing
|
||||
When sending v1/details
|
||||
| osmtype | osmid | pretty |
|
||||
| W | 297699560 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes geometry
|
||||
And the result has no attributes keywords,address,linked_places,parentof
|
||||
|
||||
Scenario: Details with addressdetails
|
||||
When sending v1/details
|
||||
| osmtype | osmid | addressdetails |
|
||||
| W | 297699560 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes address
|
||||
|
||||
Scenario: Details with linkedplaces
|
||||
When sending v1/details
|
||||
| osmtype | osmid | linkedplaces |
|
||||
| R | 123924 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes linked_places
|
||||
|
||||
Scenario: Details with hierarchy
|
||||
When sending v1/details
|
||||
| osmtype | osmid | hierarchy |
|
||||
| W | 297699560 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes hierarchy
|
||||
|
||||
Scenario: Details with grouped hierarchy
|
||||
When sending v1/details
|
||||
| osmtype | osmid | hierarchy | group_hierarchy |
|
||||
| W | 297699560 | 1 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes hierarchy
|
||||
|
||||
Scenario Outline: Details with keywords
|
||||
When sending v1/details
|
||||
| osmtype | osmid | keywords |
|
||||
| <type> | <id> | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
Then the result is valid json
|
||||
And the result has attributes keywords
|
||||
|
||||
Examples:
|
||||
| type | id |
|
||||
| W | 297699560 |
|
||||
| W | 243055645 |
|
||||
| W | 243055716 |
|
||||
| W | 43327921 |
|
||||
|
||||
# ticket #1343
|
||||
Scenario: Details of a country with keywords
|
||||
When sending v1/details
|
||||
| osmtype | osmid | keywords |
|
||||
| R | 1155955 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes keywords
|
||||
|
||||
Scenario Outline: Details with full geometry
|
||||
When sending v1/details
|
||||
| osmtype | osmid | polygon_geojson |
|
||||
| <type> | <id> | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result has attributes geometry
|
||||
And the result contains
|
||||
| geometry+type |
|
||||
| <geometry> |
|
||||
|
||||
Examples:
|
||||
| type | id | geometry |
|
||||
| W | 297699560 | LineString |
|
||||
| W | 243055645 | Polygon |
|
||||
| W | 243055716 | Polygon |
|
||||
| W | 43327921 | LineString |
|
||||
|
||||
|
||||
99
test/bdd/features/api/details/simple.feature
Normal file
99
test/bdd/features/api/details/simple.feature
Normal file
@@ -0,0 +1,99 @@
|
||||
Feature: Object details
|
||||
Check details page for correctness
|
||||
|
||||
Scenario Outline: Details request with OSM id
|
||||
When sending v1/details
|
||||
| osmtype | osmid |
|
||||
| <type> | <id> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| osm_type | osm_id |
|
||||
| <type> | <id> |
|
||||
|
||||
Examples:
|
||||
| type | id |
|
||||
| N | 5484325405 |
|
||||
| W | 43327921 |
|
||||
| R | 123924 |
|
||||
|
||||
Scenario Outline: Details request with different class types for the same OSM id
|
||||
When sending v1/details
|
||||
| osmtype | osmid | class |
|
||||
| N | 300209696 | <class> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| osm_type | osm_id | category |
|
||||
| N | 300209696 | <class> |
|
||||
|
||||
Examples:
|
||||
| class |
|
||||
| tourism |
|
||||
| mountain_pass |
|
||||
|
||||
Scenario: Details request without osmtype
|
||||
When sending v1/details
|
||||
| osmid |
|
||||
| <id> |
|
||||
Then a HTTP 400 is returned
|
||||
And the result is valid json
|
||||
|
||||
Scenario: Details request with unknown OSM id
|
||||
When sending v1/details
|
||||
| osmtype | osmid |
|
||||
| R | 1 |
|
||||
Then a HTTP 404 is returned
|
||||
And the result is valid json
|
||||
|
||||
Scenario: Details request with unknown class
|
||||
When sending v1/details
|
||||
| osmtype | osmid | class |
|
||||
| N | 300209696 | highway |
|
||||
Then a HTTP 404 is returned
|
||||
And the result is valid json
|
||||
|
||||
Scenario: Details for interpolation way return the interpolation
|
||||
When sending v1/details
|
||||
| osmtype | osmid |
|
||||
| W | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| category | type | osm_type | osm_id | admin_level |
|
||||
| place | houses | W | 1 | 15 |
|
||||
|
||||
|
||||
@skip
|
||||
Scenario: Details for interpolation way return the interpolation
|
||||
When sending details query for 112871
|
||||
Then the result is valid json
|
||||
And the result contains
|
||||
| category | type | admin_level |
|
||||
| place | houses | 15 |
|
||||
And result has not attributes osm_type,osm_id
|
||||
|
||||
|
||||
@skip
|
||||
Scenario: Details for postcode
|
||||
When sending details query for 112820
|
||||
Then the result is valid json
|
||||
And the result contains
|
||||
| category | type | admin_level |
|
||||
| place | postcode | 15 |
|
||||
And result has not attributes osm_type,osm_id
|
||||
|
||||
|
||||
Scenario Outline: Details debug output returns no errors
|
||||
When sending v1/details
|
||||
| osmtype | osmid | debug |
|
||||
| <type> | <id> | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid html
|
||||
|
||||
Examples:
|
||||
| type | id |
|
||||
| N | 5484325405 |
|
||||
| W | 43327921 |
|
||||
| R | 123924 |
|
||||
|
||||
71
test/bdd/features/api/lookup/simple.feature
Normal file
71
test/bdd/features/api/lookup/simple.feature
Normal file
@@ -0,0 +1,71 @@
|
||||
Feature: Tests for finding places by osm_type and osm_id
|
||||
Simple tests for response format.
|
||||
|
||||
Scenario Outline: Address lookup for existing object
|
||||
When sending v1/lookup with format <format>
|
||||
| osm_ids |
|
||||
| N5484325405,W43327921,,R123924,X99,N0 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And exactly 3 results are returned
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| xml | xml |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| geojson | geojson |
|
||||
| geocodejson | geocodejson |
|
||||
|
||||
Scenario: Address lookup for non-existing or invalid object
|
||||
When sending v1/lookup
|
||||
| osm_ids |
|
||||
| X99,,N0,nN158845944,ABC,,W9 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And exactly 0 results are returned
|
||||
|
||||
Scenario Outline: Boundingbox is returned
|
||||
When sending v1/lookup with format <format>
|
||||
| osm_ids |
|
||||
| N5484325405,W43327921 |
|
||||
Then the result is valid <outformat>
|
||||
And the result set contains exactly
|
||||
| object | boundingbox!in_box |
|
||||
| N5484325405 | 47.135,47.14,9.52,9.525 |
|
||||
| W43327921 | 47.07,47.08,9.50,9.52 |
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| xml | xml |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| geojson | geojson |
|
||||
|
||||
Scenario: Linked places return information from the linkee
|
||||
When sending v1/lookup with format geocodejson
|
||||
| osm_ids |
|
||||
| N1932181216 |
|
||||
Then the result is valid geocodejson
|
||||
And exactly 1 result is returned
|
||||
And all results contain
|
||||
| name |
|
||||
| Vaduz |
|
||||
|
||||
Scenario Outline: Force error by providing too many ids
|
||||
When sending v1/lookup with format <format>
|
||||
| osm_ids |
|
||||
| N1,N2,N3,N4,N5,N6,N7,N8,N9,N10,N11,N12,N13,N14,N15,N16,N17,N18,N19,N20,N21,N22,N23,N24,N25,N26,N27,N28,N29,N30,N31,N32,N33,N34,N35,N36,N37,N38,N39,N40,N41,N42,N43,N44,N45,N46,N47,N48,N49,N50,N51 |
|
||||
Then a HTTP 400 is returned
|
||||
And the result is valid <outformat>
|
||||
And the result contains
|
||||
| error+code | error+message |
|
||||
| 400 | Too many object IDs. |
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| xml | xml |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| geojson | json |
|
||||
| geocodejson | json |
|
||||
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> |
|
||||
83
test/bdd/features/api/search/language.feature
Normal file
83
test/bdd/features/api/search/language.feature
Normal file
@@ -0,0 +1,83 @@
|
||||
Feature: Localization of search results
|
||||
|
||||
Scenario: Search - default language
|
||||
When sending v1/search
|
||||
| q |
|
||||
| Liechtenstein |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And result 0 contains
|
||||
| display_name |
|
||||
| Liechtenstein |
|
||||
|
||||
Scenario: Search - accept-language first
|
||||
When sending v1/search
|
||||
| q | accept-language |
|
||||
| Liechtenstein | zh,de |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And result 0 contains
|
||||
| display_name |
|
||||
| 列支敦士登 |
|
||||
|
||||
Scenario: Search - accept-language missing
|
||||
When sending v1/search
|
||||
| q | accept-language |
|
||||
| Liechtenstein | xx,fr,en,de |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And result 0 contains
|
||||
| display_name |
|
||||
| Liechtenstein |
|
||||
|
||||
Scenario: Search - http accept language header first
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fo;q=0.8,en-ca;q=0.5,en;q=0.3 |
|
||||
When sending v1/search
|
||||
| q |
|
||||
| Liechtenstein |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And result 0 contains
|
||||
| display_name |
|
||||
| Liktinstein |
|
||||
|
||||
Scenario: Search - http accept language header and accept-language
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fr-ca,fr;q=0.8,en-ca;q=0.5,en;q=0.3 |
|
||||
When sending v1/search
|
||||
| q | accept-language |
|
||||
| Liechtenstein | fo,en |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And result 0 contains
|
||||
| display_name |
|
||||
| Liktinstein |
|
||||
|
||||
Scenario: Search - http accept language header fallback
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fo-ca,en-ca;q=0.5 |
|
||||
When sending v1/search
|
||||
| q |
|
||||
| Liechtenstein |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And result 0 contains
|
||||
| display_name |
|
||||
| Liktinstein |
|
||||
|
||||
Scenario: Search - http accept language header fallback (upper case)
|
||||
Given the HTTP header
|
||||
| accept-language |
|
||||
| fo-FR;q=0.8,en-ca;q=0.5 |
|
||||
When sending v1/search
|
||||
| q |
|
||||
| Liechtenstein |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And result 0 contains
|
||||
| display_name |
|
||||
| Liktinstein |
|
||||
361
test/bdd/features/api/search/params.feature
Normal file
361
test/bdd/features/api/search/params.feature
Normal file
@@ -0,0 +1,361 @@
|
||||
Feature: Search queries
|
||||
Testing different queries and parameters
|
||||
|
||||
Scenario: Simple XML search
|
||||
When sending v1/search with format xml
|
||||
| q |
|
||||
| Schaan |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And all results have attributes place_id,osm_type,osm_id
|
||||
And all results have attributes place_rank,boundingbox
|
||||
And all results have attributes lat,lon,display_name
|
||||
And all results have attributes class,type,importance
|
||||
And all results have no attributes address
|
||||
And all results contain
|
||||
| boundingbox!in_box |
|
||||
| 46.5,47.5,9,10 |
|
||||
|
||||
Scenario Outline: Simple JSON search
|
||||
When sending v1/search with format <format>
|
||||
| q |
|
||||
| Vaduz |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And all results have attributes place_id,licence,<cname>,type
|
||||
And all results have attributes osm_type,osm_id,boundingbox
|
||||
And all results have attributes lat,lon,display_name,importance
|
||||
And all results have no attributes address
|
||||
And all results contain
|
||||
| boundingbox!in_box |
|
||||
| 46.5,47.5,9,10 |
|
||||
|
||||
Examples:
|
||||
| format | cname |
|
||||
| json | class |
|
||||
| jsonv2 | category |
|
||||
|
||||
Scenario: Unknown formats returns a user error
|
||||
When sending v1/search with format x45
|
||||
| q |
|
||||
| Vaduz |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Scenario Outline: Search with addressdetails
|
||||
When sending v1/search with format <format>
|
||||
| q | addressdetails |
|
||||
| Triesen | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And result 0 contains in field address
|
||||
| param | value |
|
||||
| village | Triesen |
|
||||
| county | Oberland |
|
||||
| postcode | 9495 |
|
||||
| country | Liechtenstein |
|
||||
| country_code | li |
|
||||
| ISO3166-2-lvl8 | LI-09 |
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| geojson | geojson |
|
||||
| xml | xml |
|
||||
|
||||
Scenario: Coordinate search with addressdetails
|
||||
When geocoding "47.12400621,9.6047552"
|
||||
| accept-language |
|
||||
| en |
|
||||
Then all results contain
|
||||
| display_name |
|
||||
| Guschg, Valorschstrasse, Balzers, Oberland, 9497, Liechtenstein |
|
||||
|
||||
Scenario: Address details with unknown class types
|
||||
When geocoding "Kloster St. Elisabeth"
|
||||
Then result 0 contains
|
||||
| category | type | address+amenity |
|
||||
| amenity | monastery | Kloster St. Elisabeth |
|
||||
|
||||
Scenario: Disabling deduplication
|
||||
When geocoding "Malbunstr, Schaan"
|
||||
Then exactly 1 result is returned
|
||||
When geocoding "Malbunstr, Schaan"
|
||||
| dedupe |
|
||||
| 0 |
|
||||
Then exactly 4 results are returned
|
||||
|
||||
Scenario: Search with bounded viewbox in right area
|
||||
When geocoding "post"
|
||||
| bounded | viewbox |
|
||||
| 1 | 9,47,10,48 |
|
||||
Then result 0 contains
|
||||
| address+town |
|
||||
| Vaduz |
|
||||
When geocoding "post"
|
||||
| bounded | viewbox |
|
||||
| 1 | 9.49712,47.17122,9.52605,47.16242 |
|
||||
Then result 0 contains
|
||||
| address+town |
|
||||
| Schaan |
|
||||
|
||||
Scenario: Country search with bounded viewbox remain in the area
|
||||
When geocoding
|
||||
| bounded | viewbox | country |
|
||||
| 1 | 9.49712,47.17122,9.52605,47.16242 | de |
|
||||
Then exactly 0 results are returned
|
||||
|
||||
Scenario: Search with bounded viewboxlbrt in right area
|
||||
When geocoding "bar"
|
||||
| bounded | viewboxlbrt |
|
||||
| 1 | 9.49712,47.16242,9.52605,47.17122 |
|
||||
Then all results contain
|
||||
| address+town |
|
||||
| Schaan |
|
||||
|
||||
Scenario: No POI search with unbounded viewbox
|
||||
When geocoding "restaurant"
|
||||
| viewbox |
|
||||
| 9.93027,53.61634,10.10073,53.54500 |
|
||||
Then all results contain
|
||||
| display_name!fm |
|
||||
| .*[Rr]estaurant.* |
|
||||
|
||||
Scenario: bounded search remains within viewbox, even with no results
|
||||
When geocoding "[restaurant]"
|
||||
| bounded | viewbox |
|
||||
| 1 | 43.5403125,-5.6563282,43.54285,-5.662003 |
|
||||
Then exactly 0 results are returned
|
||||
|
||||
Scenario: bounded search remains within viewbox with results
|
||||
When geocoding "restaurant"
|
||||
| bounded | viewbox |
|
||||
| 1 | 9.49712,47.17122,9.52605,47.16242 |
|
||||
Then all results contain
|
||||
| boundingbox!in_box |
|
||||
| 47.16242,47.17122,9.49712,9.52605 |
|
||||
|
||||
Scenario: Prefer results within viewbox
|
||||
When geocoding "Gässle"
|
||||
| accept-language | viewbox |
|
||||
| en | 9.52413,47.10759,9.53140,47.10539 |
|
||||
Then result 0 contains
|
||||
| address+village |
|
||||
| Triesen |
|
||||
When geocoding "Gässle"
|
||||
| accept-language | viewbox |
|
||||
| en | 9.45949,47.08421,9.54094,47.05466 |
|
||||
Then result 0 contains
|
||||
| address+town |
|
||||
| Balzers |
|
||||
|
||||
Scenario: viewboxes cannot be points
|
||||
When sending v1/search
|
||||
| q | viewbox |
|
||||
| foo | 1.01,34.6,1.01,34.6 |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Scenario Outline: viewbox must have four coordinate numbers
|
||||
When sending v1/search
|
||||
| q | viewbox |
|
||||
| foo | <viewbox> |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Examples:
|
||||
| viewbox |
|
||||
| 34 |
|
||||
| 0.003,-84.4 |
|
||||
| 5.2,4.5542,12.4 |
|
||||
| 23.1,-6,0.11,44.2,9.1 |
|
||||
|
||||
Scenario Outline: viewboxlbrt must have four coordinate numbers
|
||||
When sending v1/search
|
||||
| q | viewboxlbrt |
|
||||
| foo | <viewbox> |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Examples:
|
||||
| viewbox |
|
||||
| 34 |
|
||||
| 0.003,-84.4 |
|
||||
| 5.2,4.5542,12.4 |
|
||||
| 23.1,-6,0.11,44.2,9.1 |
|
||||
|
||||
Scenario: Overly large limit number for search results
|
||||
When geocoding "restaurant"
|
||||
| limit |
|
||||
| 1000 |
|
||||
Then exactly 35 results are returned
|
||||
|
||||
Scenario: Limit number of non-duplicated search results
|
||||
When geocoding "landstr"
|
||||
| dedupe |
|
||||
| 0 |
|
||||
Then exactly 10 results are returned
|
||||
When geocoding "landstr"
|
||||
| limit | dedupe |
|
||||
| 4 | 0 |
|
||||
Then exactly 4 results are returned
|
||||
|
||||
Scenario: Limit parameter must be a number
|
||||
When sending v1/search
|
||||
| q | limit |
|
||||
| Blue Laguna | ); |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Scenario: Restrict to feature type country
|
||||
When geocoding "fürstentum"
|
||||
| featureType |
|
||||
| country |
|
||||
Then all results contain
|
||||
| place_rank |
|
||||
| 4 |
|
||||
|
||||
Scenario: Restrict to feature type state
|
||||
When geocoding "Wangerberg"
|
||||
Then more than 0 results are returned
|
||||
When geocoding "Wangerberg"
|
||||
| featureType |
|
||||
| state |
|
||||
Then exactly 0 results are returned
|
||||
|
||||
Scenario: Restrict to feature type city
|
||||
When geocoding "vaduz"
|
||||
| featureType |
|
||||
| state |
|
||||
Then exactly 0 results are returned
|
||||
When geocoding "vaduz"
|
||||
| featureType |
|
||||
| city |
|
||||
Then more than 0 results are returned
|
||||
Then all results contain
|
||||
| place_rank |
|
||||
| 16 |
|
||||
|
||||
Scenario: Restrict to feature type settlement
|
||||
When geocoding "Malbun"
|
||||
Then result 1 contains
|
||||
| category |
|
||||
| landuse |
|
||||
When geocoding "Malbun"
|
||||
| featureType |
|
||||
| settlement |
|
||||
Then all results contain
|
||||
| category | type |
|
||||
| place | village |
|
||||
|
||||
Scenario Outline: Search with polygon threshold (json)
|
||||
When sending v1/search with format json
|
||||
| q | polygon_geojson | polygon_threshold |
|
||||
| Triesenberg | 1 | <th> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And more than 0 results are returned
|
||||
And all results have attributes geojson
|
||||
|
||||
Examples:
|
||||
| th |
|
||||
| -1 |
|
||||
| 0.0 |
|
||||
| 0.5 |
|
||||
| 999 |
|
||||
|
||||
Scenario Outline: Search with polygon threshold (xml)
|
||||
When sending v1/search with format xml
|
||||
| q | polygon_geojson | polygon_threshold |
|
||||
| Triesenberg | 1 | <th> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And more than 0 results are returned
|
||||
And all results have attributes geojson
|
||||
|
||||
Examples:
|
||||
| th |
|
||||
| -1 |
|
||||
| 0.0 |
|
||||
| 0.5 |
|
||||
| 999 |
|
||||
|
||||
Scenario Outline: Search with invalid polygon threshold (xml)
|
||||
When sending v1/search with format xml
|
||||
| q | polygon_geojson | polygon_threshold |
|
||||
| Triesenberg | 1 | <th> |
|
||||
Then a HTTP 400 is returned
|
||||
|
||||
Examples:
|
||||
| th |
|
||||
| x |
|
||||
| ;; |
|
||||
| 1m |
|
||||
|
||||
Scenario Outline: Search with extratags
|
||||
When sending v1/search with format <format>
|
||||
| q | extratags |
|
||||
| Landstr | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And more than 0 results are returned
|
||||
Then all results have attributes extratags
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| xml | xml |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| geojson | geojson |
|
||||
|
||||
Scenario Outline: Search with namedetails
|
||||
When sending v1/search with format <format>
|
||||
| q | namedetails |
|
||||
| Landstr | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And more than 0 results are returned
|
||||
Then all results have attributes namedetails
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| xml | xml |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| geojson | geojson |
|
||||
|
||||
Scenario Outline: Search result with contains formatted geometry
|
||||
When sending v1/search with format <format>
|
||||
| q | <param> |
|
||||
| Triesenberg | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And more than 0 results are returned
|
||||
And all results have attributes <response_attribute>
|
||||
|
||||
Examples:
|
||||
| format | outformat | param | response_attribute |
|
||||
| xml | xml | polygon_text | geotext |
|
||||
| json | json | polygon_text | geotext |
|
||||
| jsonv2 | json | polygon_text | geotext |
|
||||
| xml | xml | polygon_svg | geosvg |
|
||||
| json | json | polygon_svg | svg |
|
||||
| jsonv2 | json | polygon_svg | svg |
|
||||
| xml | xml | polygon_kml | geokml |
|
||||
| json | json | polygon_kml | geokml |
|
||||
| jsonv2 | json | polygon_kml | geokml |
|
||||
| xml | xml | polygon_geojson | geojson |
|
||||
| json | json | polygon_geojson | geojson |
|
||||
| jsonv2 | json | polygon_geojson | geojson |
|
||||
| geojson | geojson | polygon_geojson | geojson |
|
||||
|
||||
Scenario Outline: Search result in geojson format contains no non-geojson geometry
|
||||
When sending v1/search with format geojson
|
||||
| q | <param> |
|
||||
| Triesenberg | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geojson
|
||||
And more than 0 results are returned
|
||||
And all results have no attributes <response_attribute>
|
||||
|
||||
Examples:
|
||||
| param | response_attribute |
|
||||
| polygon_text | geotext |
|
||||
| polygon_svg | svg |
|
||||
| polygon_kml | geokml |
|
||||
51
test/bdd/features/api/search/postcode.feature
Normal file
51
test/bdd/features/api/search/postcode.feature
Normal file
@@ -0,0 +1,51 @@
|
||||
Feature: Searches with postcodes
|
||||
Various searches involving postcodes
|
||||
|
||||
Scenario: US 5+4 ZIP codes are shortened to 5 ZIP codes if not found
|
||||
When geocoding "36067-1111, us"
|
||||
Then all results contain in field address
|
||||
| postcode |
|
||||
| 36067 |
|
||||
And all results contain
|
||||
| type |
|
||||
| postcode |
|
||||
|
||||
Scenario: Postcode search with address
|
||||
When geocoding "9486, mauren"
|
||||
Then result 0 contains
|
||||
| type |
|
||||
| postcode |
|
||||
|
||||
Scenario: Postcode search with country
|
||||
When geocoding "9486, li"
|
||||
Then all results contain in field address
|
||||
| country_code |
|
||||
| li |
|
||||
|
||||
Scenario: Postcode search with country code restriction
|
||||
When geocoding "9490"
|
||||
| countrycodes |
|
||||
| li |
|
||||
Then all results contain in field address
|
||||
| country_code |
|
||||
| li |
|
||||
|
||||
Scenario: Postcode search with bounded viewbox restriction
|
||||
When geocoding "9486"
|
||||
| bounded | viewbox |
|
||||
| 1 | 9.55,47.20,9.58,47.22 |
|
||||
Then all results contain in field address
|
||||
| postcode |
|
||||
| 9486 |
|
||||
When geocoding "9486"
|
||||
| bounded | viewbox |
|
||||
| 1 | 5.00,20.00,6.00,21.00 |
|
||||
Then exactly 0 result is returned
|
||||
|
||||
Scenario: Postcode search with structured query
|
||||
When geocoding ""
|
||||
| postalcode | country |
|
||||
| 9490 | li |
|
||||
Then all results contain in field address
|
||||
| country_code | postcode |
|
||||
| li | 9490 |
|
||||
212
test/bdd/features/api/search/queries.feature
Normal file
212
test/bdd/features/api/search/queries.feature
Normal file
@@ -0,0 +1,212 @@
|
||||
Feature: Search queries
|
||||
Generic search result correctness
|
||||
|
||||
Scenario: Search for natural object
|
||||
When geocoding "Samina"
|
||||
| accept-language |
|
||||
| en |
|
||||
Then result 0 contains
|
||||
| category | type | display_name |
|
||||
| waterway | river | Samina, Austria |
|
||||
|
||||
Scenario: House number search for non-street address
|
||||
When geocoding "6 Silum, Liechtenstein"
|
||||
| accept-language |
|
||||
| en |
|
||||
Then result 0 contains in field address
|
||||
| param | value |
|
||||
| house_number | 6 |
|
||||
| village | Silum |
|
||||
| town | Triesenberg |
|
||||
| county | Oberland |
|
||||
| postcode | 9497 |
|
||||
| country | Liechtenstein |
|
||||
| country_code | li |
|
||||
| ISO3166-2-lvl8 | LI-10 |
|
||||
|
||||
Scenario: Search for house number interpolation
|
||||
When geocoding "Grosssteg 1023, Triesenberg"
|
||||
| accept-language |
|
||||
| de |
|
||||
Then result 0 contains in field address
|
||||
| param | value |
|
||||
| house_number | 1023 |
|
||||
| road | Grosssteg |
|
||||
| village | Sücka |
|
||||
| postcode | 9497 |
|
||||
| town | Triesenberg |
|
||||
| country | Liechtenstein |
|
||||
| country_code | li |
|
||||
|
||||
Scenario: With missing housenumber search falls back to road
|
||||
When geocoding "Bündaweg 555"
|
||||
Then result 0 contains in field address
|
||||
| param | value |
|
||||
| road | Bündaweg |
|
||||
| village | Silum |
|
||||
| postcode | 9497 |
|
||||
| county | Oberland |
|
||||
| town | Triesenberg |
|
||||
| country | Liechtenstein |
|
||||
| country_code | li |
|
||||
| ISO3166-2-lvl8 | LI-10 |
|
||||
And all results have no attributes address+house_number
|
||||
|
||||
Scenario Outline: Housenumber 0 can be found
|
||||
When sending v1/search with format <format>
|
||||
| q | addressdetails |
|
||||
| Gnalpstrasse 0 | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And all results contain
|
||||
| display_name!fm | address+house_number |
|
||||
| 0,.* | 0 |
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| xml | xml |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| geojson | geojson |
|
||||
|
||||
Scenario: TIGER house number
|
||||
When geocoding "697 Upper Kingston Road"
|
||||
Then all results contain
|
||||
| osm_type | display_name!fm | address+house_number |
|
||||
| way | 697,.* | 697 |
|
||||
|
||||
Scenario: Search with class-type feature
|
||||
When geocoding "bars in ebenholz"
|
||||
Then all results contain
|
||||
| place_rank |
|
||||
| 30 |
|
||||
|
||||
Scenario: Search with specific amenity
|
||||
When geocoding "[restaurant] Vaduz"
|
||||
Then all results contain
|
||||
| category | type | address+country |
|
||||
| amenity | restaurant | Liechtenstein |
|
||||
|
||||
Scenario: Search with specific amenity also work in country
|
||||
When geocoding "restaurants in liechtenstein"
|
||||
Then all results contain
|
||||
| category | type | address+country |
|
||||
| amenity | restaurant | Liechtenstein |
|
||||
|
||||
Scenario: Search with key-value amenity
|
||||
When geocoding "[club=scout] Vaduz"
|
||||
Then all results contain
|
||||
| category | type |
|
||||
| club | scout |
|
||||
|
||||
Scenario: POI search near given coordinate
|
||||
When geocoding "restaurant near 47.16712,9.51100"
|
||||
Then all results contain
|
||||
| category | type |
|
||||
| amenity | restaurant |
|
||||
|
||||
Scenario: Arbitrary key/value search near given coordinate
|
||||
When geocoding "[leisure=firepit] 47.150° N 9.5340493° E"
|
||||
Then all results contain
|
||||
| category | type |
|
||||
| leisure | firepit |
|
||||
|
||||
Scenario: POI search in a bounded viewbox
|
||||
When geocoding "restaurants"
|
||||
| viewbox | bounded |
|
||||
| 9.50830,47.15253,9.52043,47.14866 | 1 |
|
||||
Then all results contain
|
||||
| category | type |
|
||||
| amenity | restaurant |
|
||||
|
||||
Scenario Outline: Key/value search near given coordinate can be restricted to country
|
||||
When geocoding "[natural=peak] 47.06512,9.53965"
|
||||
| countrycodes |
|
||||
| <cc> |
|
||||
Then all results contain
|
||||
| address+country_code |
|
||||
| <cc> |
|
||||
|
||||
Examples:
|
||||
| cc |
|
||||
| li |
|
||||
| ch |
|
||||
|
||||
Scenario: Name search near given coordinate
|
||||
When geocoding "sporry"
|
||||
Then result 0 contains
|
||||
| address+town |
|
||||
| Vaduz |
|
||||
When geocoding "sporry, 47.10791,9.52676"
|
||||
Then result 0 contains
|
||||
| address+village |
|
||||
| Triesen |
|
||||
|
||||
Scenario: Name search near given coordinate without result
|
||||
When geocoding "sporry, N 47 15 7 W 9 61 26"
|
||||
Then exactly 0 results are returned
|
||||
|
||||
Scenario: Arbitrary key/value search near a road
|
||||
When geocoding "[amenity=drinking_water] Wissfläckaweg"
|
||||
Then all results contain
|
||||
| category | type |
|
||||
| amenity | drinking_water |
|
||||
|
||||
Scenario: Ignore other country codes in structured search with country
|
||||
When geocoding
|
||||
| countrycodes | country |
|
||||
| li | de |
|
||||
Then exactly 0 results are returned
|
||||
|
||||
Scenario: Ignore country searches when query is restricted to countries
|
||||
When geocoding "fr"
|
||||
Then all results contain
|
||||
| name |
|
||||
| France |
|
||||
When geocoding "fr"
|
||||
| countrycodes |
|
||||
| li |
|
||||
Then exactly 0 results are returned
|
||||
|
||||
Scenario: Country searches only return results for the given country
|
||||
When geocoding "Ans Trail"
|
||||
| countrycodes |
|
||||
| li |
|
||||
Then all results contain
|
||||
| address+country_code |
|
||||
| li |
|
||||
|
||||
# https://trac.openstreetmap.org/ticket/5094
|
||||
Scenario: housenumbers are ordered by complete match first
|
||||
When geocoding "Austrasse 11, Vaduz"
|
||||
Then result 0 contains
|
||||
| address+house_number |
|
||||
| 11 |
|
||||
|
||||
Scenario Outline: Coordinate searches with white spaces
|
||||
When geocoding "<data>"
|
||||
Then the result set contains exactly
|
||||
| category |
|
||||
| water |
|
||||
|
||||
Examples:
|
||||
| data |
|
||||
| sporry weiher, N 47.10791° E 9.52676° |
|
||||
| sporry weiher, N 47.10791° E 9.52676° |
|
||||
| sporry weiher , N 47.10791° E 9.52676° |
|
||||
| sporry weiher, N 47.10791° E 9.52676° |
|
||||
| sporry weiher, N 47.10791° E 9.52676° |
|
||||
|
||||
Scenario: Searches with white spaces
|
||||
When geocoding "52 Bodastr,Triesenberg"
|
||||
Then all results contain
|
||||
| category | type |
|
||||
| highway | residential |
|
||||
|
||||
|
||||
# github #1949
|
||||
Scenario: Addressdetails always return the place type
|
||||
When geocoding "Vaduz"
|
||||
Then result 0 contains
|
||||
| address+town |
|
||||
| Vaduz |
|
||||
166
test/bdd/features/api/search/simple.feature
Normal file
166
test/bdd/features/api/search/simple.feature
Normal file
@@ -0,0 +1,166 @@
|
||||
Feature: Simple Tests
|
||||
Simple tests for internal server errors and response format.
|
||||
|
||||
Scenario Outline: Garbage Searches
|
||||
When sending v1/search
|
||||
| q |
|
||||
| <query> |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And exactly 0 results are returned
|
||||
|
||||
Examples:
|
||||
| query |
|
||||
| New York, New York |
|
||||
| 12, Main Street, Houston |
|
||||
| München |
|
||||
| 東京都 |
|
||||
| hotels in sdfewf |
|
||||
| xywxkrf |
|
||||
| gh; foo() |
|
||||
| %#$@*&l;der#$! |
|
||||
| 234.23.14.5 |
|
||||
| aussenstelle universitat lichtenstein wachterhaus aussenstelle universitat lichtenstein wachterhaus aussenstelle universitat lichtenstein wachterhaus aussenstelle universitat lichtenstein wachterhaus |
|
||||
|
||||
Scenario: Empty XML search
|
||||
When sending v1/search with format xml
|
||||
| q |
|
||||
| xnznxvcx |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
Then the result metadata contains
|
||||
| param | value |
|
||||
| querystring | xnznxvcx |
|
||||
| more_url!fm | .*q=xnznxvcx.*format=xml |
|
||||
|
||||
Scenario: Empty XML search with special XML characters
|
||||
When sending v1/search with format xml
|
||||
| q |
|
||||
| xfdghn&zxn"xvbyx<vxx>cssdex |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
Then the result metadata contains
|
||||
| param | value |
|
||||
| querystring | xfdghn&zxn"xvbyx<vxx>cssdex |
|
||||
| more_url!fm | .*q=xfdghn%26zxn%22xvbyx%3Cvxx%3Ecssdex.*format=xml |
|
||||
|
||||
Scenario: Empty XML search with viewbox
|
||||
When sending v1/search with format xml
|
||||
| q | viewbox |
|
||||
| xnznxvcx | 12,33,77,45.13 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result metadata contains
|
||||
| param | value |
|
||||
| querystring | xnznxvcx |
|
||||
| viewbox | 12,33,77,45.13 |
|
||||
|
||||
Scenario: Empty XML search with viewboxlbrt
|
||||
When sending v1/search with format xml
|
||||
| q | viewboxlbrt |
|
||||
| xnznxvcx | 12,34.13,77,45 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result metadata contains
|
||||
| param | value |
|
||||
| querystring | xnznxvcx |
|
||||
| viewbox | 12,34.13,77,45 |
|
||||
|
||||
Scenario: Empty XML search with viewboxlbrt and viewbox
|
||||
When sending v1/search with format xml
|
||||
| q | viewbox | viewboxblrt |
|
||||
| pub | 12,33,77,45.13 | 1,2,3,4 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result metadata contains
|
||||
| param | value |
|
||||
| querystring | pub |
|
||||
| viewbox | 12,33,77,45.13 |
|
||||
|
||||
Scenario: Empty XML search with excluded place ids
|
||||
When sending v1/search with format xml
|
||||
| q | exclude_place_ids |
|
||||
| jghrleoxsbwjer | 123,76,342565 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result metadata contains
|
||||
| param | value |
|
||||
| exclude_place_ids | 123,76,342565 |
|
||||
|
||||
Scenario: Empty XML search with bad excluded place ids
|
||||
When sending v1/search with format xml
|
||||
| q | exclude_place_ids |
|
||||
| jghrleoxsbwjer | , |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result metadata has no attributes exclude_place_ids
|
||||
|
||||
Scenario Outline: Wrapping of illegal jsonp search requests
|
||||
When sending v1/search with format json
|
||||
| q | json_callback |
|
||||
| Tokyo | <data> |
|
||||
Then a HTTP 400 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| error+code | error+message |
|
||||
| 400 | Invalid json_callback value |
|
||||
|
||||
Examples:
|
||||
| data |
|
||||
| 1asd |
|
||||
| bar(foo) |
|
||||
| XXX['bad'] |
|
||||
| foo; evil |
|
||||
| 234 |
|
||||
|
||||
Scenario: Ignore jsonp parameter for anything but json
|
||||
When sending v1/search with format xml
|
||||
| q | json_callback |
|
||||
| Tokyo | 234 |
|
||||
Then a HTTP 200 is returned
|
||||
Then the result is valid xml
|
||||
|
||||
Scenario Outline: Empty search for json like
|
||||
When sending v1/search with format <format>
|
||||
| q |
|
||||
| YHlERzzx |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid <outformat>
|
||||
And exactly 0 results are returned
|
||||
|
||||
Examples:
|
||||
| format | outformat |
|
||||
| json | json |
|
||||
| jsonv2 | json |
|
||||
| geojson | geojson |
|
||||
| geocodejson | geocodejson |
|
||||
|
||||
Scenario: Search for non-existing coordinates
|
||||
When geocoding "-21.0,-33.0"
|
||||
Then exactly 0 results are returned
|
||||
|
||||
Scenario: Country code selection is retained in more URL (#596)
|
||||
When sending v1/search with format xml
|
||||
| q | countrycodes |
|
||||
| Vaduz | pl,1,,invalid,undefined,%3Cb%3E,bo,, |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result metadata contains
|
||||
| more_url!fm |
|
||||
| .*&countrycodes=pl%2Cbo&.* |
|
||||
|
||||
Scenario Outline: Search debug output does not return errors
|
||||
When sending v1/search
|
||||
| q | debug |
|
||||
| <query> | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid html
|
||||
|
||||
Examples:
|
||||
| query |
|
||||
| Liechtenstein |
|
||||
| Triesen |
|
||||
| Pfarrkirche |
|
||||
| Landstr 27 Steinort, Triesenberg, 9495 |
|
||||
| 9497 |
|
||||
| restaurant in triesen |
|
||||
72
test/bdd/features/api/search/structured.feature
Normal file
72
test/bdd/features/api/search/structured.feature
Normal file
@@ -0,0 +1,72 @@
|
||||
Feature: Structured search queries
|
||||
Testing correctness of results with
|
||||
structured queries
|
||||
|
||||
Scenario: Structured search for country only
|
||||
When geocoding
|
||||
| country |
|
||||
| Liechtenstein |
|
||||
Then all results contain in field address
|
||||
| country_code | country |
|
||||
| li | Liechtenstein |
|
||||
|
||||
Scenario: Structured search for postcode only
|
||||
When geocoding
|
||||
| postalcode |
|
||||
| 9495 |
|
||||
Then all results contain
|
||||
| type!fm | address+postcode |
|
||||
| ^post(al_)?code | 9495 |
|
||||
|
||||
Scenario: Structured search for street, postcode and country
|
||||
When sending v1/search with format xml
|
||||
| street | postalcode | country |
|
||||
| Old Palace Road | GU2 7UP | United Kingdom |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid xml
|
||||
And the result metadata contains
|
||||
| querystring |
|
||||
| Old Palace Road, GU2 7UP, United Kingdom |
|
||||
|
||||
Scenario: Structured search for street with housenumber, city and postcode
|
||||
When geocoding
|
||||
| street | city | postalcode |
|
||||
| 19 Am schrägen Weg | Vaduz | 9490 |
|
||||
Then all results contain in field address
|
||||
| house_number | road |
|
||||
| 19 | Am Schrägen Weg |
|
||||
|
||||
Scenario: Structured search for street with housenumber, city and bad postcode
|
||||
When geocoding
|
||||
| street | city | postalcode |
|
||||
| 19 Am schrägen Weg | Vaduz | 9491 |
|
||||
Then all results contain in field address
|
||||
| house_number | road |
|
||||
| 19 | Am Schrägen Weg |
|
||||
|
||||
Scenario: Structured search for amenity, city
|
||||
When geocoding
|
||||
| city | amenity |
|
||||
| Vaduz | bar |
|
||||
Then all results contain
|
||||
| address+country | category | type!fm |
|
||||
| Liechtenstein | amenity | (pub)\|(bar)\|(restaurant) |
|
||||
|
||||
#176
|
||||
Scenario: Structured search restricts rank
|
||||
When geocoding
|
||||
| city |
|
||||
| Steg |
|
||||
Then all results contain
|
||||
| addresstype |
|
||||
| village |
|
||||
|
||||
#3651
|
||||
Scenario: Structured search with surrounding extra characters
|
||||
When geocoding
|
||||
| street | city | postalcode |
|
||||
| "19 Am schrägen Weg" | "Vaduz" | "9491" |
|
||||
Then all results contain in field address
|
||||
| house_number | road |
|
||||
| 19 | Am Schrägen Weg |
|
||||
|
||||
42
test/bdd/features/api/search/v1_geocodejson.feature
Normal file
42
test/bdd/features/api/search/v1_geocodejson.feature
Normal file
@@ -0,0 +1,42 @@
|
||||
Feature: Search API geocodejson output
|
||||
Testing correctness of geocodejson output.
|
||||
|
||||
Scenario: Search geocodejson - City housenumber-level address with street
|
||||
When sending v1/search with format geocodejson
|
||||
| q | addressdetails |
|
||||
| Im Winkel 8, Triesen | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson
|
||||
And all results contain
|
||||
| housenumber | street | postcode | city | country |
|
||||
| 8 | Im Winkel | 9495 | Triesen | Liechtenstein |
|
||||
|
||||
Scenario: Search geocodejson - Town street-level address with street
|
||||
When sending v1/search with format geocodejson
|
||||
| q | addressdetails |
|
||||
| Gnetsch, Balzers | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson
|
||||
And all results contain
|
||||
| name | city | postcode | country |
|
||||
| Gnetsch | Balzers | 9496 | Liechtenstein |
|
||||
|
||||
Scenario: Search geocodejson - Town street-level address with footway
|
||||
When sending v1/search with format geocodejson
|
||||
| q | addressdetails |
|
||||
| burg gutenberg 6000 jahre geschichte | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson
|
||||
And all results contain
|
||||
| street | city | postcode | country |
|
||||
| Burgweg | Balzers | 9496 | Liechtenstein |
|
||||
|
||||
Scenario: Search geocodejson - City address with suburb
|
||||
When sending v1/search with format geocodejson
|
||||
| q | addressdetails |
|
||||
| Lochgass 5, Ebenholz, Vaduz | 1 |
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid geocodejson
|
||||
And all results contain
|
||||
| housenumber | street | district | city | postcode | country |
|
||||
| 5 | Lochgass | Ebenholz | Vaduz | 9490 | Liechtenstein |
|
||||
19
test/bdd/features/api/status/failures.feature
Normal file
19
test/bdd/features/api/status/failures.feature
Normal file
@@ -0,0 +1,19 @@
|
||||
Feature: Status queries against unknown database
|
||||
Testing status query
|
||||
|
||||
Background:
|
||||
Given an unknown database
|
||||
|
||||
Scenario: Failed status as text
|
||||
When sending v1/status
|
||||
Then a HTTP 500 is returned
|
||||
And the page content equals "ERROR: Database connection failed"
|
||||
|
||||
Scenario: Failed status as json
|
||||
When sending v1/status with format json
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| status!:d | message |
|
||||
| 700 | Database connection failed |
|
||||
And the result has no attributes data_updated
|
||||
15
test/bdd/features/api/status/simple.feature
Normal file
15
test/bdd/features/api/status/simple.feature
Normal file
@@ -0,0 +1,15 @@
|
||||
Feature: Status queries
|
||||
Testing status query
|
||||
|
||||
Scenario: Status as text
|
||||
When sending v1/status
|
||||
Then a HTTP 200 is returned
|
||||
And the page content equals "OK"
|
||||
|
||||
Scenario: Status as json
|
||||
When sending v1/status with format json
|
||||
Then a HTTP 200 is returned
|
||||
And the result is valid json
|
||||
And the result contains
|
||||
| status!:d | message | data_updated!fm |
|
||||
| 0 | OK | ....-..-..T..:..:...00:00 |
|
||||
Reference in New Issue
Block a user