Skip to content

Commit

Permalink
Test WFS GetCapabilities operation URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed Sep 11, 2023
1 parent 6b897c2 commit a27f703
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions test_tools/geoserver_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def get_wfs_url(workspace, service_endpoint='wfs'):
return get_url(workspace, service_endpoint)


def get_wfs_capabilities(workspace=None, service_endpoint='wfs', headers=None):
def get_wfs_capabilities(workspace=None, service_endpoint='wfs', headers=None, version=None):
wfs_url = get_url(workspace, service_endpoint)
return wfs_direct(wfs_url, headers=headers)
return wfs_direct(wfs_url, headers=headers, version=version)


def get_wms_capabilities(workspace=None, service_endpoint='ows', headers=None, version=None):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
import pytest
from test_tools import geoserver_client

PROXY_PREFIX = '/layman-proxy'
headers = {'X-Forwarded-Prefix': PROXY_PREFIX,
'X-Forwarded-Path': '/some-other-proxy',
}


@pytest.mark.parametrize('version', [
'1.3.0',
'1.1.1'
])
@pytest.mark.usefixtures('ensure_layman_module')
def test_wms_get_capabilities(version):
proxy_prefix = '/layman-proxy'
headers = {'X-Forwarded-Prefix': proxy_prefix,
'X-Forwarded-Path': '/some-other-proxy',
}
wms_inst = geoserver_client.get_wms_capabilities(workspace=None,
version=version,
headers=headers,
)
assert all(m.get('url').startswith(f'http://localhost:8000{proxy_prefix}/geoserver/') for operation in
assert all(m.get('url').startswith(f'http://localhost:8000{PROXY_PREFIX}/geoserver/') for operation in
['GetCapabilities', 'GetMap', 'GetFeatureInfo'] for m in wms_inst.getOperationByName(operation).methods)


@pytest.mark.parametrize('version', [
'2.0.0',
'1.1.0'
])
@pytest.mark.usefixtures('ensure_layman_module')
def test_wfs_get_capabilities(version):
wfs_inst = geoserver_client.get_wfs_capabilities(workspace=None,
version=version,
headers=headers,
)
assert all(m.get('url').startswith(f'http://localhost:8000{PROXY_PREFIX}/geoserver/') for operation in
['GetCapabilities', 'DescribeFeatureType', 'GetFeature'] for m in wfs_inst.getOperationByName(operation).methods)

0 comments on commit a27f703

Please sign in to comment.