]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/api/search/simple.feature
Merge branch 'separate-compilation' of https://github.com/eyusupov/Nominatim into...
[nominatim.git] / test / bdd / api / search / simple.feature
1 @APIDB
2 Feature: Simple Tests
3     Simple tests for internal server errors and response format.
4
5     Scenario Outline: Testing different parameters
6         When sending search query "Hamburg"
7           | param       | value   |
8           | <parameter> | <value> |
9         Then at least 1 result is returned
10         When sending html search query "Hamburg"
11           | param       | value   |
12           | <parameter> | <value> |
13         Then at least 1 result is returned
14         When sending xml search query "Hamburg"
15           | param       | value   |
16           | <parameter> | <value> |
17         Then at least 1 result is returned
18         When sending json search query "Hamburg"
19           | param       | value   |
20           | <parameter> | <value> |
21         Then at least 1 result is returned
22         When sending jsonv2 search query "Hamburg"
23           | param       | value   |
24           | <parameter> | <value> |
25         Then at least 1 result is returned
26         When sending geojson search query "Hamburg"
27           | param       | value   |
28           | <parameter> | <value> |
29         Then at least 1 result is returned
30         When sending geocodejson search query "Hamburg"
31           | param       | value   |
32           | <parameter> | <value> |
33         Then at least 1 result is returned
34
35     Examples:
36      | parameter        | value |
37      | addressdetails   | 1 |
38      | addressdetails   | 0 |
39      | polygon_text     | 1 |
40      | polygon_text     | 0 |
41      | polygon_kml      | 1 |
42      | polygon_kml      | 0 |
43      | polygon_geojson  | 1 |
44      | polygon_geojson  | 0 |
45      | polygon_svg      | 1 |
46      | polygon_svg      | 0 |
47      | accept-language  | de,en |
48      | countrycodes     | de |
49      | bounded          | 1 |
50      | bounded          | 0 |
51      | exclude_place_ids| 385252,1234515 |
52      | limit            | 1000 |
53      | dedupe           | 1 |
54      | dedupe           | 0 |
55      | extratags        | 1 |
56      | extratags        | 0 |
57      | namedetails      | 1 |
58      | namedetails      | 0 |
59
60     Scenario: Search with invalid output format
61         When sending search query "Berlin"
62           | format |
63           | fd$# |
64         Then a HTTP 400 is returned
65
66     Scenario Outline: Simple Searches
67         When sending search query "<query>"
68         Then the result is valid html
69         When sending html search query "<query>"
70         Then the result is valid html
71         When sending xml search query "<query>"
72         Then the result is valid xml
73         When sending json search query "<query>"
74         Then the result is valid json
75         When sending jsonv2 search query "<query>"
76         Then the result is valid json
77         When sending geojson search query "<query>"
78         Then the result is valid geojson
79
80     Examples:
81      | query |
82      | New York, New York |
83      | France |
84      | 12, Main Street, Houston |
85      | München |
86      | 東京都 |
87      | hotels in nantes |
88      | xywxkrf |
89      | gh; foo() |
90      | %#$@*&l;der#$! |
91      | 234 |
92      | 47.4,8.3 |
93
94     Scenario: Empty XML search
95         When sending xml search query "xnznxvcx"
96         Then result header contains
97           | attr        | value |
98           | querystring | xnznxvcx |
99           | more_url    | .*q=xnznxvcx.*format=xml |
100
101     Scenario: Empty XML search with special XML characters
102         When sending xml search query "xfdghn&zxn"xvbyx<vxx>cssdex"
103         Then result header contains
104           | attr        | value |
105           | querystring | xfdghn&zxn"xvbyx<vxx>cssdex |
106           | more_url    | .*q=xfdghn%26zxn%22xvbyx%3Cvxx%3Ecssdex.*format=xml |
107
108     Scenario: Empty XML search with viewbox
109         When sending xml search query "xnznxvcx"
110           | viewbox |
111           | 12,33,77,45.13 |
112         Then result header contains
113           | attr        | value |
114           | querystring | xnznxvcx |
115           | viewbox     | 12,33,77,45.13 |
116
117     Scenario: Empty XML search with viewboxlbrt
118         When sending xml search query "xnznxvcx"
119           | viewboxlbrt |
120           | 12,34.13,77,45 |
121         Then result header contains
122           | attr        | value |
123           | querystring | xnznxvcx |
124           | viewbox     | 12,34.13,77,45 |
125
126     Scenario: Empty XML search with viewboxlbrt and viewbox
127         When sending xml search query "pub"
128           | viewbox        | viewboxblrt |
129           | 12,33,77,45.13 | 1,2,3,4 |
130         Then result header contains
131           | attr        | value |
132           | querystring | pub |
133           | viewbox     | 12,33,77,45.13 |
134
135     Scenario: Empty XML search with exluded place ids
136         When sending xml search query "jghrleoxsbwjer"
137           | exclude_place_ids |
138           | 123,76,342565 |
139         Then result header contains
140           | attr              | value |
141           | exclude_place_ids | 123,76,342565 |
142
143     Scenario: Empty XML search with bad exluded place ids
144         When sending xml search query "jghrleoxsbwjer"
145           | exclude_place_ids |
146           | , |
147         Then result header has not attributes exclude_place_ids
148
149     Scenario Outline: Wrapping of legal jsonp search requests
150         When sending json search query "Tokyo"
151             | param        | value |
152             |json_callback | <data> |
153         Then result header contains
154             | attr         | value |
155             | json_func    | <result> |
156
157     Examples:
158      | data    | result |
159      | foo     | foo |
160      | FOO     | FOO |
161      | __world | __world |
162      | $me     | \$me |
163      | m1[4]   | m1\[4\] |
164      | d_r[$d] | d_r\[\$d\] |
165
166     Scenario Outline: Wrapping of illegal jsonp search requests
167         When sending json search query "Tokyo"
168             | param        | value |
169             |json_callback | <data> |
170         Then a json user error is returned
171
172     Examples:
173       | data |
174       | 1asd |
175       | bar(foo) |
176       | XXX['bad'] |
177       | foo; evil |
178
179     Scenario: Ignore jsonp parameter for anything but json
180         When sending json search query "Malibu"
181           | json_callback |
182           | 234 |
183         Then a HTTP 400 is returned
184         When sending xml search query "Malibu"
185           | json_callback |
186           | 234 |
187         Then the result is valid xml
188         When sending html search query "Malibu"
189           | json_callback |
190           | 234 |
191         Then the result is valid html
192
193     Scenario: Empty JSON search
194         When sending json search query "YHlERzzx"
195         Then exactly 0 results are returned
196
197     Scenario: Empty JSONv2 search
198         When sending jsonv2 search query "Flubb XdfESSaZx"
199         Then exactly 0 results are returned
200
201     Scenario: Search for non-existing coordinates
202         When sending json search query "-21.0,-33.0"
203         Then exactly 0 results are returned
204
205     Scenario: Country code selection is retained in more URL (#596)
206         When sending xml search query "Vaduz"
207           | countrycodes |
208           | pl,1,,invalid,undefined,%3Cb%3E,bo,, |
209         Then result header contains
210           | attr     | value |
211           | more_url | .*&countrycodes=pl%2Cbo&.* |
212
213     Scenario Outline: Search with debug prints valid HTML
214         When sending html search query "<query>"
215           | extratags | addressdetails | namedetails | debug |
216           | 1         | 1              | 1           | 1     |
217         Then the result is valid html
218
219         Examples:
220           | query |
221           | 10, Alvierweg, 9490, Vaduz |
222           | Hamburg |