File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 31
31
32
32
import osgeo .gdal # NOQA
33
33
34
+ from owslib .wms import WebMapService
35
+
34
36
from test_qgsserver import QgsServerTestBase
35
37
from qgis .core import QgsProject
36
38
@@ -216,6 +218,26 @@ def test_wms_GetProjectSettings_wms_print_layers(self):
216
218
self .assertTrue (xmlResult .find ("<WMSDataSource>contextualWMSLegend=0&crs=EPSG:21781&dpiMode=7&featureCount=10&format=image/png&layers=public_geo_gemeinden&styles=&url=https://qgiscloud.com/mhugent/qgis_unittest_wms/wms?</WMSDataSource>" ) != - 1 )
217
219
self .assertTrue (xmlResult .find ("<WMSPrintLayer>contextualWMSLegend=0&amp;crs=EPSG:21781&amp;dpiMode=7&amp;featureCount=10&amp;format=image/png&amp;layers=public_geo_gemeinden&amp;styles=&amp;url=https://qgiscloud.com/mhugent/qgis_unittest_wms_print/wms?</WMSPrintLayer>" ) != - 1 )
218
220
221
+ def test_getcapabilities_owslib (self ):
222
+
223
+ # read getcapabilities document
224
+ docPath = self .testdata_path + 'getcapabilities.txt'
225
+ f = open (docPath , 'r' )
226
+ doc = f .read ()
227
+ f .close ()
228
+
229
+ # clean header in doc
230
+ doc = doc .replace ('Content-Length: 5775\n ' , '' )
231
+ doc = doc .replace ('Content-Type: text/xml; charset=utf-8\n \n ' , '' )
232
+ doc = doc .replace ('<?xml version="1.0" encoding="utf-8"?>\n ' , '' )
233
+
234
+ # read capabilities document with owslib
235
+ w = WebMapService (None , xml = doc , version = '1.3.0' )
236
+
237
+ # check content
238
+ rootLayerName = 'QGIS Test Project'
239
+ self .assertTrue (rootLayerName in w .contents .keys ())
240
+
219
241
220
242
if __name__ == '__main__' :
221
243
unittest .main ()
You can’t perform that action at this time.
0 commit comments