def test_get_agol_not_existing_feature_raise_exception( config_ArcGIS_ESRIJSON ): """Testing query for a not existing object""" p = OGRProvider(config_ArcGIS_ESRIJSON) with pytest.raises(ProviderItemNotFoundError): p.get(-1)
def test_get_not_existing_feature_raise_exception( config_shapefile_4326 ): """Testing query for a not existing object""" p = OGRProvider(config_shapefile_4326) with pytest.raises(ProviderItemNotFoundError): p.get(-1)
def test_get_ms_not_existing_feature_raise_exception( config_MapServer_WFS ): """Testing query for a not existing object""" p = OGRProvider(config_MapServer_WFS) with pytest.raises(ProviderItemNotFoundError): p.get(-1)
def test_get_gs_with_geojson_output_too_complex_raise_exception( config_geonode_gs_WFS): """Testing query for a specific object with too complex geojson""" p = OGRProvider(config_geonode_gs_WFS) assert p.open_options.get('URL') is None p.open_options[ 'URL'] = 'https://geonode.wfp.org/geoserver/wfs?outputformat=json' with pytest.raises(ProviderQueryError): p.get(272)
def test_get_gs(config_GeoServer_WFS): """Testing query for a specific object""" p = OGRProvider(config_GeoServer_WFS) result = p.get('inspireadressen.1747652') assert result['id'] == 'inspireadressen.1747652' assert 'Mosselsepad' in result['properties']['straatnaam']
def test_get_geosol_gs(config_geosol_gs_WFS): """Testing query for a specific object""" p = OGRProvider(config_geosol_gs_WFS) result = p.get('Unesco_point.123') assert result['id'] == 'Unesco_point.123' assert 'Centro storico di San Gimignano' in result['properties']['sito']
def test_get_ms(config_MapServer_WFS): """Testing query for a specific object""" p = OGRProvider(config_MapServer_WFS) result = p.get('stations.4403') assert result['id'] == 'stations.4403' assert '01' in result['properties']['station']
def test_get_vsicurl(config_vsicurl_csv): """Testing query for a specific object""" p = OGRProvider(config_vsicurl_csv) result = p.get('32') assert result['id'] == 32 assert '14' in result['properties']['codice_regione']
def test_get_ms(config_MapServer_WFS_cities): """Testing query for a specific object""" p = OGRProvider(config_MapServer_WFS_cities) result = p.get('cities.8338') assert result['id'] == 'cities.8338' assert 'Buenos Aires' in result['properties']['NAME']
def test_get_agol(config_ArcGIS_ESRIJSON): """Testing query for a specific object""" p = OGRProvider(config_ArcGIS_ESRIJSON) result = p.get('78232831') assert result['id'] == 78232831 assert '2605' in result['properties']['fulladdr']
def test_get_agol(config_ArcGIS_ESRIJSON, config_random_id): """Testing query for a specific object""" p = OGRProvider(config_ArcGIS_ESRIJSON) id, addr_number = config_random_id result = p.get(id) assert result['id'] == id assert addr_number in result['properties']['fulladdr']
def test_get_gs(config_MapServer_WFS_continents): """Testing query for a specific object""" p = OGRProvider(config_MapServer_WFS_continents) result = p.get('continents.23774') assert result['id'] == 'continents.23774' assert result['properties']['NA2DESC'] == 'Canada' assert result['properties']['NA3DESC'] == 'North America'
def config_random_id(config_ArcGIS_ESRIJSON): p = OGRProvider(config_ArcGIS_ESRIJSON) # Get bunch of features to randomly have an id feature_collection = p.query(startindex=0, limit=10, resulttype='results') features = feature_collection.get('features', None) features_list = [] for feature in features: features_list.append(feature['id']) selected_id = random.choice(features_list) fulladdr = p.get(selected_id)['properties']['fulladdr'] return (selected_id, fulladdr.split(' ')[0])
def test_get(config_poi_portugal): p = OGRProvider(config_poi_portugal) result = p.get(536678593) assert result['id'] == 536678593 assert 'cafe' in result['properties']['fclass']
def test_get(config_poi_portugal): p = OGRProvider(config_poi_portugal) result = p.get(5156778016) assert result['id'] == 5156778016 assert 'tourist_info' in result['properties']['fclass']