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