]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/api/search_simple.feature
add mention of required Tiger files for test database
[nominatim.git] / tests / features / api / search_simple.feature
1 Feature: Simple Tests
2     Simple tests for internal server errors and response format.
3     These tests should pass on any Nominatim installation.
4
5     Scenario Outline: Testing different parameters
6         Given the request parameters
7           | <parameter>
8           | <value>
9         When sending search query "Manchester"
10         Then the result is valid html
11         Given the request parameters
12           | <parameter>
13           | <value>
14         When sending html search query "Manchester"
15         Then the result is valid html
16         Given the request parameters
17           | <parameter>
18           | <value>
19         When sending xml search query "Manchester"
20         Then the result is valid xml
21         Given the request parameters
22           | <parameter>
23           | <value>
24         When sending json search query "Manchester"
25         Then the result is valid json
26         Given the request parameters
27           | <parameter>
28           | <value>
29         When sending jsonv2 search query "Manchester"
30         Then the result is valid json
31
32     Examples:
33      | parameter        | value
34      | addressdetails   | 1
35      | addressdetails   | 0
36      | polygon          | 1
37      | polygon          | 0
38      | polygon_text     | 1
39      | polygon_text     | 0
40      | polygon_kml      | 1
41      | polygon_kml      | 0
42      | polygon_geojson  | 1
43      | polygon_geojson  | 0
44      | polygon_svg      | 1
45      | polygon_svg      | 0
46      | accept-language  | de,en
47      | countrycodes     | uk,ir
48      | bounded          | 1
49      | bounded          | 0
50      | exclude_place_ids| 385252,1234515
51      | limit            | 1000
52      | dedupe           | 1
53      | dedupe           | 0
54      | extratags        | 1
55      | extratags        | 0
56      | namedetails      | 1
57      | namedetails      | 0
58
59     Scenario: Search with invalid output format
60         Given the request parameters
61           | format
62           | fd$#
63         When sending search query "Berlin"
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
78     Examples:
79      | query
80      | New York, New York
81      | France
82      | 12, Main Street, Houston
83      | München
84      | 東京都
85      | hotels in nantes
86      | xywxkrf
87      | gh; foo()
88      | %#$@*&l;der#$!
89      | 234
90      | 47.4,8.3
91
92     Scenario: Empty XML search
93         When sending xml search query "xnznxvcx"
94         Then result header contains
95           | attr        | value
96           | querystring | xnznxvcx
97           | polygon     | false
98           | more_url    | .*format=xml.*q=xnznxvcx.*
99
100     Scenario: Empty XML search with special XML characters
101         When sending xml search query "xfdghn&zxn"xvbyx<vxx>cssdex"
102         Then result header contains
103           | attr        | value
104           | querystring | xfdghn&zxn"xvbyx<vxx>cssdex
105           | polygon     | false
106           | more_url    | .*format=xml.*q=xfdghn&zxn"xvbyx<vxx>cssdex.*
107
108     Scenario: Empty XML search with viewbox
109         Given the request parameters
110           | viewbox
111           | 12,45.13,77,33
112         When sending xml search query "xnznxvcx"
113         Then result header contains
114           | attr        | value
115           | querystring | xnznxvcx
116           | polygon     | false
117           | viewbox     | 12,45.13,77,33
118
119     Scenario: Empty XML search with viewboxlbrt
120         Given the request parameters
121           | viewboxlbrt
122           | 12,34.13,77,45
123         When sending xml search query "xnznxvcx"
124         Then result header contains
125           | attr        | value
126           | querystring | xnznxvcx
127           | polygon     | false
128           | viewbox     | 12,45.13,77,33
129
130     Scenario: Empty XML search with viewboxlbrt and viewbox
131         Given the request parameters
132           | viewbox        | viewboxblrt
133           | 12,45.13,77,33 | 1,2,3,4
134         When sending xml search query "pub"
135         Then result header contains
136           | attr        | value
137           | querystring | pub
138           | polygon     | false
139           | viewbox     | 12,45.13,77,33
140
141
142     Scenario Outline: Empty XML search with polygon values
143         Given the request parameters
144           | polygon
145           | <polyval>
146         When sending xml search query "xnznxvcx"
147         Then result header contains
148           | attr        | value
149           | polygon     | <result>
150
151     Examples:
152      | result | polyval
153      | false  | 0
154      | true   | 1
155      | true   | True
156      | true   | true
157      | true   | false
158      | true   | FALSE
159      | true   | yes
160      | true   | no
161      | true   | '; delete from foobar; select '
162
163
164     Scenario: Empty XML search with exluded place ids
165         Given the request parameters
166           | exclude_place_ids
167           | 123,76,342565
168         When sending xml search query "jghrleoxsbwjer"
169         Then result header contains
170           | attr              | value
171           | exclude_place_ids | 123,76,342565
172
173     Scenario: Empty XML search with bad exluded place ids
174         Given the request parameters
175           | exclude_place_ids
176           | ,
177         When sending xml search query "jghrleoxsbwjer"
178         Then result header has no attribute exclude_place_ids
179
180     Scenario Outline: Wrapping of legal jsonp search requests
181         Given the request parameters
182           | json_callback
183           | <data>
184         When sending json search query "Tokyo"
185         Then there is a json wrapper "<data>"
186
187     Examples:
188      | data
189      | foo
190      | FOO
191      | __world
192      | $me
193      | m1[4]
194      | d_r[$d]
195
196     Scenario Outline: Wrapping of illegal jsonp search requests
197         Given the request parameters
198           | json_callback
199           | <data>
200         When sending json search query "Tokyo"
201         Then a HTTP 400 is returned
202
203     Examples:
204       | data
205       | 1asd
206       | bar(foo)
207       | XXX['bad']
208       | foo; evil
209
210     Scenario Outline: Ignore jsonp parameter for anything but json
211         Given the request parameters
212           | json_callback
213           | 234
214         When sending json search query "Malibu"
215         Then a HTTP 400 is returned
216         Given the request parameters
217           | json_callback
218           | 234
219         When sending xml search query "Malibu"
220         Then the result is valid xml
221         Given the request parameters
222           | json_callback
223           | 234
224         When sending html search query "Malibu"
225         Then the result is valid html
226
227      Scenario: Empty JSON search
228         When sending json search query "YHlERzzx"
229         Then exactly 0 results are returned
230
231      Scenario: Empty JSONv2 search
232         When sending jsonv2 search query "Flubb XdfESSaZx"
233         Then exactly 0 results are returned
234
235      Scenario: Search for non-existing coordinates
236         When sending json search query "-21.0,-33.0"
237         Then exactly 0 results are returned
238