mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
more API tests (mostly for user errors)
This commit is contained in:
@@ -15,6 +15,15 @@ Feature: Parameters for Reverse API
|
|||||||
| jsonv2 |
|
| jsonv2 |
|
||||||
| xml |
|
| xml |
|
||||||
|
|
||||||
|
Scenario Outline: Coordinates must be floating-point numbers
|
||||||
|
When sending reverse coordinates <coords>
|
||||||
|
Then a HTTP 400 is returned
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| coords |
|
||||||
|
| -45.3,; |
|
||||||
|
| gkjd,50 |
|
||||||
|
|
||||||
Scenario Outline: Reverse Geocoding with extratags
|
Scenario Outline: Reverse Geocoding with extratags
|
||||||
When sending <format> reverse coordinates 10.776234290950017,106.70425325632095
|
When sending <format> reverse coordinates 10.776234290950017,106.70425325632095
|
||||||
| extratags |
|
| extratags |
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ Feature: Search queries
|
|||||||
And result 0 has not attributes address
|
And result 0 has not attributes address
|
||||||
And result 0 has bounding box in 46.5,47.5,9,10
|
And result 0 has bounding box in 46.5,47.5,9,10
|
||||||
|
|
||||||
|
Scenario: Unknown formats returns a user error
|
||||||
|
When sending search query "Vaduz"
|
||||||
|
| format |
|
||||||
|
| x45 |
|
||||||
|
Then a HTTP 400 is returned
|
||||||
|
|
||||||
Scenario: JSON search with addressdetails
|
Scenario: JSON search with addressdetails
|
||||||
When sending json search query "Montevideo" with address
|
When sending json search query "Montevideo" with address
|
||||||
Then address of result 0 is
|
Then address of result 0 is
|
||||||
@@ -165,6 +171,12 @@ Feature: Search queries
|
|||||||
| 4 |
|
| 4 |
|
||||||
Then exactly 4 results are returned
|
Then exactly 4 results are returned
|
||||||
|
|
||||||
|
Scenario: Limit parameter must be a number
|
||||||
|
When sending search query "Blue Laguna"
|
||||||
|
| limit |
|
||||||
|
| ); |
|
||||||
|
Then a HTTP 400 is returned
|
||||||
|
|
||||||
Scenario: Restrict to feature type country
|
Scenario: Restrict to feature type country
|
||||||
When sending xml search query "Uruguay"
|
When sending xml search query "Uruguay"
|
||||||
Then results contain
|
Then results contain
|
||||||
|
|||||||
20
test/bdd/api/search/postcode.feature
Normal file
20
test/bdd/api/search/postcode.feature
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@APIDB
|
||||||
|
Feature: Searches with postcodes
|
||||||
|
Various searches involving postcodes
|
||||||
|
|
||||||
|
Scenario: US 5+4 ZIP codes are shortened to 5 ZIP codes if not found
|
||||||
|
When sending json search query "57701 1111, us" with address
|
||||||
|
Then result addresses contain
|
||||||
|
| postcode |
|
||||||
|
| 57701 |
|
||||||
|
|
||||||
|
Scenario: Postcode search with address
|
||||||
|
When sending json search query "9486, mauren"
|
||||||
|
Then at least 1 result is returned
|
||||||
|
|
||||||
|
Scenario: Postcode search with country
|
||||||
|
When sending json search query "9486, li" with address
|
||||||
|
Then result addresses contain
|
||||||
|
| country_code |
|
||||||
|
| li |
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ def website_search_request(context, fmt, query, addr):
|
|||||||
|
|
||||||
context.response = SearchResponse(outp, outfmt, status)
|
context.response = SearchResponse(outp, outfmt, status)
|
||||||
|
|
||||||
@when(u'sending (?P<fmt>\S+ )?reverse coordinates (?P<lat>[0-9.-]+)?,(?P<lon>[0-9.-]+)?')
|
@when(u'sending (?P<fmt>\S+ )?reverse coordinates (?P<lat>.+)?,(?P<lon>.+)?')
|
||||||
def website_reverse_request(context, fmt, lat, lon):
|
def website_reverse_request(context, fmt, lat, lon):
|
||||||
params = {}
|
params = {}
|
||||||
if lat is not None:
|
if lat is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user