]> git.openstreetmap.org Git - nominatim.git/blobdiff - tests/steps/api_setup.py
tests for update of search_name table
[nominatim.git] / tests / steps / api_setup.py
index 35443cdba6e1dabc3584697827974c379a7278c9..b5a098fcc2023adb746ead972d49e75e653f31ce 100644 (file)
@@ -36,7 +36,7 @@ def api_call(requesttype):
         world.response_format = fmt
     elif fmt in ('json', 'jsonv2'):
         if 'json_callback' in world.params:
         world.response_format = fmt
     elif fmt in ('json', 'jsonv2'):
         if 'json_callback' in world.params:
-            world.json_callback = world.params['json_callback']
+            world.json_callback = world.params['json_callback'].encode('utf8')
             assert world.page.startswith(world.json_callback + '(')
             assert world.page.endswith(')')
             world.page = world.page[(len(world.json_callback)+1):-1]
             assert world.page.startswith(world.json_callback + '(')
             assert world.page.endswith(')')
             world.page = world.page[(len(world.json_callback)+1):-1]
@@ -123,6 +123,13 @@ def api_setup_details(step, obj):
         world.params['place_id']  = obj
     api_call('details')
 
         world.params['place_id']  = obj
     api_call('details')
 
+@step(u'looking up (\w+) places ((?:[a-z]\d+,*)+)')
+def api_setup_lookup(step, fmt, ids):
+    world.params['osm_ids'] = ids
+    if fmt and fmt.strip():
+        world.params['format'] = fmt.strip()
+    api_call('lookup')
+
 @step(u'sending an API call (\w+)')
 def api_general_call(step, call):
     api_call(call)
 @step(u'sending an API call (\w+)')
 def api_general_call(step, call):
     api_call(call)