]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/bdd/steps/steps_api_queries.py
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / test / bdd / steps / steps_api_queries.py
index 22517338bab04f664198222680f273ae358882a1..7bf38d14526f13f3e9273e3c795a01f16700f110 100644 (file)
@@ -9,10 +9,12 @@
     Queries may either be run directly via PHP using the query script
     or via the HTTP interface using php-cgi.
 """
     Queries may either be run directly via PHP using the query script
     or via the HTTP interface using php-cgi.
 """
+from pathlib import Path
 import json
 import os
 import re
 import logging
 import json
 import os
 import re
 import logging
+import asyncio
 from urllib.parse import urlencode
 
 from utils import run_script
 from urllib.parse import urlencode
 
 from utils import run_script
@@ -72,6 +74,16 @@ def send_api_query(endpoint, params, fmt, context):
             for h in context.table.headings:
                 params[h] = context.table[0][h]
 
             for h in context.table.headings:
                 params[h] = context.table[0][h]
 
+    if context.nominatim.api_engine is None:
+        return send_api_query_php(endpoint, params, context)
+
+    return asyncio.run(context.nominatim.api_engine(endpoint, params,
+                                                    Path(context.nominatim.website_dir.name),
+                                                    context.nominatim.test_env))
+
+
+
+def send_api_query_php(endpoint, params, context):
     env = dict(BASE_SERVER_ENV)
     env['QUERY_STRING'] = urlencode(params)
 
     env = dict(BASE_SERVER_ENV)
     env['QUERY_STRING'] = urlencode(params)