1 """ Steps that run search queries.
3 Queries may either be run directly via PHP using the query script
4 or via the HTTP interface.
10 class SearchResponse(object):
12 def __init__(response,
14 @when(u'searching for "(?P<query>.*)"( with params)?$')
15 def query_cmd(context, query):
16 """ Query directly via PHP script.
18 cmd = [os.path.join(context.nominatim.build_dir, 'utils', 'query.php'),
20 # add more parameters in table form
22 for h in context.table.headings:
23 value = context.table[0][h].strip()
25 cmd.extend(('--' + h, value))
27 proc = subprocess.Popen(cmd, cwd=context.nominatim.build_dir,
28 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
29 (outp, err) = proc.communicate()
31 assert_equals (0, proc.returncode), "query.php failed with message: %s" % err
35 world.response_format = 'json'
36 world.request_type = 'search'
37 world.returncode = 200