add tests for different scripts

This commit is contained in:
Sarah Hoffmann
2021-04-26 23:01:06 +02:00
parent a21a0864f1
commit 1fd483643b
2 changed files with 28 additions and 1 deletions

View File

@@ -37,3 +37,24 @@ Feature: Import and search of names
Then placex contains
| object | country_code | name | name+name:fi | name+name:de |
| N1 | de | german | finnish | local |
Scenario Outline: Names in any script can be found
Given the places
| osm | class | type | name |
| N1 | place | hamlet | <name> |
When importing
And sending search query "<name>"
Then results contain
| osm |
| N1 |
Examples:
| name |
| Berlin |
| |
| Вологда |
| Αθήνα |
| القاهرة |
| |
| |
| |

View File

@@ -8,6 +8,8 @@ import xml.etree.ElementTree as ET
from check_functions import Almost
OSM_TYPE = {'N' : 'node', 'W' : 'way', 'R' : 'relation'}
def _geojson_result_to_json_result(geojson_result):
result = geojson_result['properties']
result['geojson'] = geojson_result['geometry']
@@ -131,7 +133,11 @@ class GenericResponse:
if name == 'ID':
pass
elif name == 'osm':
self.assert_field(i, 'osm_type', value[0])
assert 'osm_type' in self.result[i], \
"Result row {} has no field 'osm_type'.\nFull row: {}"\
.format(i, json.dumps(self.result[i], indent=4))
assert self.result[i]['osm_type'] in (OSM_TYPE[value[0]], value[0]), \
BadRowValueAssert(self, i, 'osm_type', value)
self.assert_field(i, 'osm_id', value[1:])
elif name == 'centroid':
lon, lat = value.split(' ')