]> git.openstreetmap.org Git - nominatim.git/commitdiff
finish search API tests
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 21 Dec 2016 19:28:27 +0000 (20:28 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 30 Dec 2016 21:58:58 +0000 (22:58 +0100)
test/bdd/api/search/queries.feature
test/bdd/api/search/structured.feature [new file with mode: 0644]
test/bdd/steps/queries.py

index 78669c4f876927297121d9eadc4c79216597bc71..0074e3344fe5301f0523742d190394713be36f75 100644 (file)
@@ -56,3 +56,12 @@ Feature: Search queries
         Then results contain
           | place_rank |
           | 30 |
         Then results contain
           | place_rank |
           | 30 |
+
+    # https://trac.openstreetmap.org/ticket/5094
+    Scenario: housenumbers are ordered by complete match first
+        When sending json search query "6395 geminis, montevideo" with address
+        Then result addresses contain
+          | ID | house_number |
+          | 0  | 6395 |
+          | 1  | 6395 BIS |
+
diff --git a/test/bdd/api/search/structured.feature b/test/bdd/api/search/structured.feature
new file mode 100644 (file)
index 0000000..c93603d
--- /dev/null
@@ -0,0 +1,38 @@
+@APIDB
+Feature: Structured search queries
+    Testing correctness of results with
+    structured queries
+
+    Scenario: Country only
+        When sending json search query "" with address
+          | country |
+          | Liechtenstein |
+        Then address of result 0 is
+          | type         | value |
+          | country      | Liechtenstein |
+          | country_code | li |
+
+    Scenario: Postcode only
+        When sending json search query "" with address
+          | postalcode |
+          | 22547 |
+        Then results contain
+          | type |
+          | postcode |
+        And result addresses contain
+          | postcode |
+          | 22547 |
+
+    Scenario: Street, postcode and country
+        When sending xml search query "" with address
+          | street          | postalcode | country |
+          | Old Palace Road | GU2 7UP    | United Kingdom |
+        Then result header contains
+          | attr        | value |
+          | querystring | Old Palace Road, GU2 7UP, United Kingdom |
+
+    Scenario: gihub #176
+        When sending json search query "" with address
+          | city |
+          | Mercedes |
+        Then at least 1 result is returned
index d0cda77469bab1559260e3af3b6f3529ffdfa775..b02a6661b7ce46f1e2aeec141f227375ce58d7f4 100644 (file)
@@ -177,7 +177,9 @@ def query_cmd(context, query, dups):
 def website_search_request(context, fmt, query, addr):
     env = BASE_SERVER_ENV
 
 def website_search_request(context, fmt, query, addr):
     env = BASE_SERVER_ENV
 
-    params = { 'q' : query }
+    params = {}
+    if query:
+        params['q'] = query
     if fmt is not None:
         params['format'] = fmt.strip()
     if addr is not None:
     if fmt is not None:
         params['format'] = fmt.strip()
     if addr is not None: