41 |
41 |
</ows:ServiceIdentification>
|
42 |
42 |
</wfs:WFS_Capabilities>'''
|
43 |
43 |
|
|
44 |
FAKE_SERVICE_CAPABILITIES_V1_0_0 = '''<?xml version="1.0" encoding="UTF-8"?>
|
|
45 |
<wfs:WFS_Capabilities version="1.0.0"
|
|
46 |
xmlns:wfs="http://www.opengis.net/wfs/2.0"
|
|
47 |
xmlns:ows="http://www.opengis.net/ows/1.1">
|
|
48 |
<ows:ServiceIdentification>
|
|
49 |
<ows:Title/><ows:Abstract/>
|
|
50 |
<ows:ServiceType>WFS</ows:ServiceType><ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion><ows:Fees/>
|
|
51 |
<ows:AccessConstraints/>
|
|
52 |
</ows:ServiceIdentification>
|
|
53 |
</wfs:WFS_Capabilities>'''
|
|
54 |
|
44 |
55 |
FAKE_FEATURES_JSON = '''
|
45 |
56 |
{
|
46 |
57 |
"features": [
|
... | ... | |
227 |
238 |
return utils.FakedResponse(status_code=200, content=FAKE_SERVICE_CAPABILITIES)
|
228 |
239 |
return utils.FakedResponse(status_code=200, content=FAKE_FEATURES_JSON)
|
229 |
240 |
|
|
241 |
def geoserver_responses_v1_0_0(url, **kwargs):
|
|
242 |
if kwargs['params'].get('request') == 'GetCapabilities':
|
|
243 |
return utils.FakedResponse(status_code=200, content=FAKE_SERVICE_CAPABILITIES_V1_0_0)
|
|
244 |
return utils.FakedResponse(status_code=200, content=FAKE_FEATURES_JSON)
|
230 |
245 |
|
231 |
246 |
def geoserver_responses_errors(url, **kwargs):
|
232 |
247 |
if kwargs['params'].get('request') == 'GetCapabilities':
|
... | ... | |
395 |
410 |
assert '<ows:' in result['data']['content']
|
396 |
411 |
|
397 |
412 |
|
|
413 |
@pytest.mark.parametrize("server_responses, version, typename_label", [
|
|
414 |
(geoserver_responses_v1_0_0, '1.0.0', 'TYPENAME'),
|
|
415 |
(geoserver_responses, '2.0.0', 'TYPENAMES')])
|
|
416 |
@mock.patch('passerelle.utils.Request.get')
|
|
417 |
def test_typename_parameter_upgrade(mocked_get, server_responses, version, typename_label, app, connector):
|
|
418 |
endpoint = utils.generic_endpoint_url('opengis', 'features', slug=connector.slug)
|
|
419 |
assert endpoint == '/opengis/test/features'
|
|
420 |
mocked_get.side_effect = server_responses
|
|
421 |
resp = app.get(endpoint, params={'type_names': '...', 'property_name': '...'})
|
|
422 |
assert mocked_get.call_args[1]['params']['REQUEST'] == 'GetFeature'
|
|
423 |
assert mocked_get.call_args[1]['params']['VERSION'] == version
|
|
424 |
assert typename_label in mocked_get.call_args[1]['params'].keys()
|
|
425 |
|
|
426 |
|
398 |
427 |
@mock.patch('passerelle.utils.Request.get')
|
399 |
428 |
def test_reverse_geocoding(mocked_get, app, connector):
|
400 |
429 |
connector.search_radius = 45
|
401 |
|
-
|