]> git.openstreetmap.org Git - nominatim.git/commitdiff
add tests for geocodejson and fix syntax errors
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 12 Jul 2018 20:00:18 +0000 (22:00 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 12 Jul 2018 20:00:18 +0000 (22:00 +0200)
lib/template/address-geocodejson.php
lib/template/search-geocodejson.php
test/bdd/api/reverse/simple.feature
test/bdd/api/search/simple.feature
test/bdd/steps/queries.py

index 480a4f9e4673b6e0224de7692bc12969284f4fde..68fae7d1605dcde0b883be5e806dec791d662291 100644 (file)
@@ -76,6 +76,6 @@ if (empty($aPlace)) {
                                            'licence' => 'ODbL',
                                            'query' => $sQuery
                                           ),
-                           'features' => $aFilteredPlaces
+                           'features' => [$aFilteredPlaces]
                           ));
 }
index f3c577d95ac96c643d1f3b08c4e6ff9684739d76..29bfe0bf58d4fae3be47896c26d64b00e6bfcf03 100644 (file)
@@ -9,8 +9,8 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
                                )
               );
 
-    if (isset($aPlace['place_id'])) $aPlace['properties']['geocoding']['place_id'] = $aPointDetails['place_id'];
-    $sOSMType = formatOSMType($aPlace['osm_type']);
+    if (isset($aPointDetails['place_id'])) $aPlace['properties']['geocoding']['place_id'] = $aPointDetails['place_id'];
+    $sOSMType = formatOSMType($aPointDetails['osm_type']);
     if ($sOSMType) {
         $aPlace['properties']['geocoding']['osm_type'] = $sOSMType;
         $aPlace['properties']['geocoding']['osm_id'] = $aPointDetails['osm_id'];
index 115b0fd39554e33252d9051ebdb0ce9febf7572c..ccd0becdbb8a837fa62dd64e0b66481ee98ca276 100644 (file)
@@ -48,6 +48,10 @@ Feature: Simple Reverse Tests
           | param       | value   |
           | <parameter> | <value> |
         Then the result is valid geojson
+        When sending geocodejson reverse coordinates 53.603,10.041
+          | param       | value   |
+          | <parameter> | <value> |
+        Then the result is valid geocodejson
 
     Examples:
      | parameter        | value |
index 06c24a2ee014f002ea47ed50be2f9e76975f97db..5cd80a83de36f77dbd7fe643f0262bd0780c49b2 100644 (file)
@@ -27,6 +27,10 @@ Feature: Simple Tests
           | param       | value   |
           | <parameter> | <value> |
         Then at least 1 result is returned
+        When sending geocodejson search query "Hamburg"
+          | param       | value   |
+          | <parameter> | <value> |
+        Then at least 1 result is returned
 
     Examples:
      | parameter        | value |
index 1584d1ed7eeb78b316285f16270a75f3f8beaae8..62bc295eea0ca72bec9d5a1cbb753b94b2cda41a 100644 (file)
@@ -114,6 +114,9 @@ class SearchResponse(GenericResponse):
         self.parse_json()
         self.result = geojson_results_to_json_results(self.result)
 
+    def parse_geocodejson(self):
+        return self.parse_geojson()
+
     def parse_html(self):
         content, errors = tidy_document(self.page,
                                         options={'char-encoding' : 'utf8'})
@@ -195,6 +198,9 @@ class ReverseResponse(GenericResponse):
             return
         self.result = geojson_results_to_json_results(self.result[0])
 
+    def parse_geocodejson(self):
+        return self.parse_geojson()
+
     def parse_xml(self):
         et = ET.fromstring(self.page)