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:
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 |
|
||||
Reference in New Issue
Block a user