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