]> git.openstreetmap.org Git - nominatim.git/blobdiff - tests/steps/api_setup.py
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / tests / steps / api_setup.py
index 9accf4206ccea4a2cb57d17663237834ebc378e2..fcaa39a2adc91c01c4c9747f754562dc8f990452 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.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]
@@ -103,6 +103,16 @@ def api_setup_reverse(step, fmt, lat, lon):
         world.params['format'] = fmt.strip()
     api_call('reverse')
 
+@step(u'looking up place ([NRW]?\d+)')
+def api_setup_details_reverse(step, obj):
+    if obj[0] in ('N', 'R', 'W'):
+        # an osm id
+        world.params['osm_type']  = obj[0]
+        world.params['osm_id'] = obj[1:]
+    else:
+        world.params['place_id']  = obj
+    api_call('reverse')
+
 @step(u'looking up details for ([NRW]?\d+)')
 def api_setup_details(step, obj):
     if obj[0] in ('N', 'R', 'W'):
@@ -112,3 +122,7 @@ def api_setup_details(step, obj):
     else:
         world.params['place_id']  = obj
     api_call('details')
+
+@step(u'sending an API call (\w+)')
+def api_general_call(step, call):
+    api_call(call)