]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/features/api/reverse/v1_params.feature
release 5.3.2.post9
[nominatim.git] / test / bdd / features / api / reverse / v1_params.feature
1 Feature: v1/reverse Parameter Tests
2     Tests for parameter inputs for the v1 reverse endpoint.
3     This file contains mostly bad parameter input. Valid parameters
4     are tested in the format tests.
5
6     Scenario: Bad format
7         When sending v1/reverse
8           | lat         | lon           | format |
9           | 47.14122383 | 9.52169581334 | sdf |
10         Then a HTTP 400 is returned
11
12     Scenario: Missing lon parameter
13         When sending v1/reverse
14           | lat   |
15           | 52.52 |
16         Then a HTTP 400 is returned
17
18     Scenario: Missing lat parameter
19         When sending v1/reverse
20           | lon |
21           | 52.52 |
22         Then a HTTP 400 is returned
23
24     Scenario Outline: Bad format for lat or lon
25         When sending v1/reverse
26           | lat   | lon   |
27           | <lat> | <lon> |
28         Then a HTTP 400 is returned
29
30         Examples:
31           | lat      | lon |
32           | 48.9660  | 8,4482 |
33           | 48,9660  | 8.4482 |
34           | 48,9660  | 8,4482 |
35           | 48.966.0 | 8.4482 |
36           | 48.966   | 8.448.2 |
37           | Nan      | 8.448  |
38           | 48.966   | Nan    |
39           | Inf      | 5.6    |
40           | 5.6      | -Inf   |
41           | <script></script> | 3.4 |
42           | 3.4 | <script></script> |
43           | -45.3    | ;      |
44           | gkjd     | 50     |
45
46     Scenario: Non-numerical zoom levels return an error
47         When sending v1/reverse
48           | lat         | lon           | zoom |
49           | 47.14122383 | 9.52169581334 | adfe |
50         Then a HTTP 400 is returned
51
52     Scenario Outline: Truthy values for boolean parameters
53         When sending v1/reverse
54           | lat         | lon           | addressdetails |
55           | 47.14122383 | 9.52169581334 | <value> |
56         Then a HTTP 200 is returned
57         And the result is valid xml
58         And the result has attributes address
59
60         When sending v1/reverse
61           | lat         | lon           | extratags |
62           | 47.14122383 | 9.52169581334 | <value> |
63         Then a HTTP 200 is returned
64         And the result is valid xml
65         And the result has attributes extratags
66
67         When sending v1/reverse
68           | lat         | lon           | namedetails |
69           | 47.14122383 | 9.52169581334 | <value> |
70         Then a HTTP 200 is returned
71         And the result is valid xml
72         And the result has attributes namedetails
73
74         Examples:
75           | value |
76           | yes   |
77           | no    |
78           | -1    |
79           | 100   |
80           | false |
81           | 00    |
82
83     Scenario: Only one geometry can be requested
84         When sending v1/reverse
85           | lat         | lon           | polygon_text | polygon_svg |
86           | 47.14122383 | 9.52169581334 | 1            | 1           |
87         Then a HTTP 400 is returned
88
89     Scenario Outline: Illegal jsonp are not allowed
90         When sending v1/reverse with format json
91           | lat         | lon           | json_callback |
92           | 47.14122383 | 9.52169581334 | <data> |
93         Then a HTTP 400 is returned
94
95         Examples:
96           | data |
97           | 1asd |
98           | bar(foo) |
99           | XXX['bad'] |
100           | foo; evil |
101
102     Scenario Outline: Reverse debug mode produces valid HTML
103         Given debug output is enabled
104         When sending v1/reverse
105           | lat   | lon   | debug |
106           | <lat> | <lon> | 1 |
107         Then a HTTP 200 is returned
108         And the result is valid html
109
110         Examples:
111           | lat      | lon     |
112           | 0.0      | 0.0     |
113           | 47.06645 | 9.56601 |
114           | 47.14081 | 9.52267 |
115
116     Scenario Outline: Full address display for city housenumber-level address with street
117         When sending v1/reverse with format <format>
118           | lat        | lon        |
119           | 47.1068011 | 9.52810091 |
120         Then a HTTP 200 is returned
121         And the result is valid <outformat>
122         And the result contains in field address
123           | param          | value     |
124           | house_number   | 8         |
125           | road           | Im Winkel |
126           | neighbourhood  | Oberdorf  |
127           | village        | Triesen   |
128           | ISO3166-2-lvl8 | LI-09     |
129           | county         | Oberland  |
130           | postcode       | 9495      |
131           | country        | Liechtenstein |
132           | country_code   | li        |
133
134         Examples:
135           | format  | outformat |
136           | json    | json |
137           | jsonv2  | json |
138           | xml     | xml |
139
140     Scenario Outline: Results with name details
141         When sending v1/reverse with format <format>
142           | lat      | lon     | zoom | namedetails |
143           | 47.14052 | 9.52202 | 14   | 1           |
144         Then a HTTP 200 is returned
145         And the result is valid <outformat>
146         And the result contains in field namedetails
147           | name     |
148           | Ebenholz |
149
150         Examples:
151           | format  | outformat |
152           | json    | json |
153           | jsonv2  | json |
154           | xml     | xml |
155
156     Scenario Outline: Results with extratags
157         When sending v1/reverse with format <format>
158           | lat      | lon     | zoom | extratags |
159           | 47.14052 | 9.52202 | 14   | 1         |
160         Then a HTTP 200 is returned
161         And the result is valid <outformat>
162         And the result contains in field extratags
163           | wikidata |
164           | Q4529531 |
165
166         Examples:
167           | format | outformat |
168           | json   | json |
169           | jsonv2 | json |
170           | xml    | xml |
171
172     Scenario Outline: Reverse with entrances
173         When sending v1/reverse with format <format>
174           | lat               | lon              | entrances | zoom |
175           | 47.24942041089678 | 9.52854573737568 | 1         | 18   |
176         Then a HTTP 200 is returned
177         And the result is valid <outformat>
178         And the result contains array field entrances where element 0 contains
179           | osm_id     | type | lat        | lon       |
180           | 6580031131 | yes  | 47.2489382 | 9.5284033 |
181
182         Examples:
183           | format | outformat |
184           | json   | json |
185           | jsonv2 | json |
186
187     Scenario Outline: Unknown layers are rejected
188         When sending v1/reverse
189           | lat         | lon           | layer   |
190           | 47.14122383 | 9.52169581334 | <layer> |
191         Then a HTTP 400 is returned
192
193         Examples:
194           | layer |
195           | bogus |
196           | address,bogus |
197
198     Scenario Outline: An empty layer parameter disables layer filtering
199         When sending v1/reverse
200           | lat         | lon           | layer   |
201           | 47.14122383 | 9.52169581334 | <layer> |
202         Then a HTTP 200 is returned
203
204         Examples:
205           | layer |
206           |       |
207           | ,     |