Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[WMSServer] Add unit test for group short name for getcapabilities an…
…d getmap operations
  • Loading branch information
tcoupin committed Jul 26, 2018
1 parent 5280ab0 commit fd5c8e7
Show file tree
Hide file tree
Showing 9 changed files with 5,852 additions and 4,274 deletions.
18 changes: 18 additions & 0 deletions tests/src/python/test_qgsserver_wms_getmap.py
Expand Up @@ -1037,6 +1037,24 @@ def test_wms_getmap_group(self):

self.assertEqual(r_individual, r_group, 'Individual layers query and group layers query results should be identical')

qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectGroupsPath),
"SERVICE": "WMS",
"VERSION": "1.1.1",
"REQUEST": "GetMap",
"LAYERS": "group_short_name",
"STYLES": "",
"FORMAT": "image/png",
"BBOX": "-16817707,-4710778,5696513,14587125",
"HEIGHT": "500",
"WIDTH": "500",
"CRS": "EPSG:3857"
}.items())])

r_group, _ = self._result(self._execute_request(qs))

self.assertEqual(r_individual, r_group, 'Individual layers query and group layers query with short name results should be identical')

qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(self.projectGroupsPath),
"SERVICE": "WMS",
Expand Down
101 changes: 101 additions & 0 deletions tests/testdata/qgis_server/getcapabilities.txt
Expand Up @@ -116,6 +116,30 @@ Content-Type: text/xml; charset=utf-8
<KeywordList>
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
</KeywordList>
<Layer queryable="1">
<Name>layer_with_short_name</Name>
<Title>A Layer with a short name</Title>
<Abstract>A Layer with an abstract</Abstract>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>8.20346</westBoundLongitude>
<eastBoundLongitude>8.20355</eastBoundLongitude>
<southBoundLatitude>44.9014</southBoundLatitude>
<northBoundLatitude>44.9015</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
<Style>
<Name>default</Name>
<Title>default</Title>
<LegendURL>
<Format>image/png</Format>
<OnlineResource xlink:type="simple" xlink:href="https://www.qgis.org/?MAP=tests/testdata/qgis_server/test_project.qgs&amp;SERVICE=WMS&amp;VERSION=1.3.0&amp;REQUEST=GetLegendGraphic&amp;LAYER=layer_with_short_name&amp;FORMAT=image/png&amp;STYLE=default" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</LegendURL>
</Style>
</Layer>
<Layer queryable="1">
<Name>testlayer èé</Name>
<Title>A test vector layer</Title>
Expand All @@ -140,6 +164,83 @@ Content-Type: text/xml; charset=utf-8
</LegendURL>
</Style>
</Layer>
<Layer>
<Name>group_name</Name>
<Title>Group title</Title>
<Abstract>Group abstract</Abstract>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>8.20346</westBoundLongitude>
<eastBoundLongitude>8.20355</eastBoundLongitude>
<southBoundLatitude>44.9014</southBoundLatitude>
<northBoundLatitude>44.9015</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
<Layer queryable="1">
<Name>testlayer</Name>
<Title>testlayer</Title>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>8.20346</westBoundLongitude>
<eastBoundLongitude>8.20355</eastBoundLongitude>
<southBoundLatitude>44.9014</southBoundLatitude>
<northBoundLatitude>44.9015</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
<Style>
<Name>default</Name>
<Title>default</Title>
<LegendURL>
<Format>image/png</Format>
<OnlineResource xlink:type="simple" xlink:href="https://www.qgis.org/?*****" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</LegendURL>
</Style>
</Layer>
</Layer>
<Layer>
<Name>groupwithoutshortname</Name>
<Title>groupwithoutshortname</Title>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>8.20346</westBoundLongitude>
<eastBoundLongitude>8.20355</eastBoundLongitude>
<southBoundLatitude>44.9014</southBoundLatitude>
<northBoundLatitude>44.9015</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
<Layer queryable="1">
<Name>testlayer</Name>
<Title>testlayer</Title>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:3857</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>8.20346</westBoundLongitude>
<eastBoundLongitude>8.20355</eastBoundLongitude>
<southBoundLatitude>44.9014</southBoundLatitude>
<northBoundLatitude>44.9015</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
<Style>
<Name>default</Name>
<Title>default</Title>
<LegendURL>
<Format>image/png</Format>
<OnlineResource xlink:type="simple" xlink:href="https://www.qgis.org/?*****" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</LegendURL>
</Style>
</Layer>
</Layer>
</Layer>
</Capability>
</WMS_Capabilities>
48 changes: 44 additions & 4 deletions tests/testdata/qgis_server/getcontext.txt
Expand Up @@ -2,9 +2,9 @@
Content-Type: text/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<OWSContext xmlns:ogc="http://www.opengis.net/ogc" version="0.3.1" xmlns:context="http://www.opengis.net/context" xmlns="http://www.opengis.net/ows-context" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ows-context="http://www.opengis.net/ows-context" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" id="ows-context-test_project" xmlns:ows="http://www.opengis.net/ows" xmlns:ns9="http://www.w3.org/2005/Atom" xmlns:ins="http://www.inspire.org">
<OWSContext xmlns:gml="http://www.opengis.net/gml" xmlns:context="http://www.opengis.net/context" xmlns:ows="http://www.opengis.net/ows" xmlns="http://www.opengis.net/ows-context" xmlns:ins="http://www.inspire.org" id="ows-context-test_project" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows-context="http://www.opengis.net/ows-context" xmlns:ns9="http://www.w3.org/2005/Atom" xmlns:kml="http://www.opengis.net/kml/2.2" version="0.3.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sld="http://www.opengis.net/sld" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<General>
<Window width="800" height="600"/>
<Window height="600" width="800"/>
<ows:Title>QGIS TestProject</ows:Title>
<ows:Abstract><![CDATA[Some UTF8 text èòù]]></ows:Abstract>
<ows:BoundingBox crs="EPSG:4326">
Expand All @@ -13,10 +13,36 @@ Content-Type: text/xml; charset=utf-8
</ows:BoundingBox>
</General>
<ResourceList>
<Layer group="groupwithoutshortname" hidden="true" queryable="true" id="testlayer" name="testlayer" opacity="1">
<ows:Title>testlayer</ows:Title>
<ows:OutputFormat>image/png</ows:OutputFormat>
<Server default="true" service="urn:ogc:serviceType:WMS" version="1.3.0">
<OnlineResource xlink:href="https://www.qgis.org/?*****"/>
</Server>
<StyleList>
<Style current="true">
<Name>default</Name>
<Title>default</Title>
</Style>
</StyleList>
</Layer>
<Layer group="groupwithshortname" hidden="true" queryable="true" id="testlayer" name="testlayer" opacity="1">
<ows:Title>testlayer</ows:Title>
<ows:OutputFormat>image/png</ows:OutputFormat>
<Server default="true" service="urn:ogc:serviceType:WMS" version="1.3.0">
<OnlineResource xlink:href="https://www.qgis.org/?*****"/>
</Server>
<StyleList>
<Style current="true">
<Name>default</Name>
<Title>default</Title>
</Style>
</StyleList>
</Layer>
<Layer hidden="true" queryable="true" id="testlayer_èé" name="testlayer èé" opacity="1">
<ows:Title>A test vector layer</ows:Title>
<ows:OutputFormat>image/png</ows:OutputFormat>
<Server version="1.3.0" default="true" service="urn:ogc:serviceType:WMS">
<Server default="true" service="urn:ogc:serviceType:WMS" version="1.3.0">
<OnlineResource xlink:href="https://www.qgis.org/?*****"/>
</Server>
<ows:Abstract>A test vector layer with unicode òà</ows:Abstract>
Expand All @@ -27,5 +53,19 @@ Content-Type: text/xml; charset=utf-8
</Style>
</StyleList>
</Layer>
<Layer hidden="true" queryable="true" id="layer_with_short_name" name="layer_with_short_name" opacity="1">
<ows:Title>A Layer with a short name</ows:Title>
<ows:OutputFormat>image/png</ows:OutputFormat>
<Server default="true" service="urn:ogc:serviceType:WMS" version="1.3.0">
<OnlineResource xlink:href="https://www.qgis.org/?*****"/>
</Server>
<ows:Abstract>A Layer with an abstract</ows:Abstract>
<StyleList>
<Style current="true">
<Name>default</Name>
<Title>default</Title>
</Style>
</StyleList>
</Layer>
</ResourceList>
</OWSContext>
</OWSContext>

0 comments on commit fd5c8e7

Please sign in to comment.