Skip to content

Commit f60812a

Browse files
committedApr 29, 2020
Fix tests for qgsserver
1 parent 3b00911 commit f60812a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
 

‎tests/src/python/test_qgsserver.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ def test_requestHandler(self):
330330
request = QgsBufferServerRequest('http://somesite.com/somepath', QgsServerRequest.GetMethod, headers)
331331
response = QgsBufferServerResponse()
332332
self.server.handleRequest(request, response)
333-
self.assertEqual(bytes(response.body()), b'<ServerException>Project file error</ServerException>\n')
334-
self.assertEqual(response.headers(), {'Content-Length': '54', 'Content-Type': 'text/xml; charset=utf-8'})
333+
self.assertEqual(bytes(response.body()), b'<ServerException>Project file error. For OWS services: please provide a SERVICE and a MAP parameter pointing to a valid QGIS project file</ServerException>\n')
334+
self.assertEqual(response.headers(), {'Content-Length': '156', 'Content-Type': 'text/xml; charset=utf-8'})
335335
self.assertEqual(response.statusCode(), 500)
336336

337337
def test_requestHandlerProject(self):
@@ -340,8 +340,8 @@ def test_requestHandlerProject(self):
340340
request = QgsBufferServerRequest('http://somesite.com/somepath', QgsServerRequest.GetMethod, headers)
341341
response = QgsBufferServerResponse()
342342
self.server.handleRequest(request, response, None)
343-
self.assertEqual(bytes(response.body()), b'<ServerException>Project file error</ServerException>\n')
344-
self.assertEqual(response.headers(), {'Content-Length': '54', 'Content-Type': 'text/xml; charset=utf-8'})
343+
self.assertEqual(bytes(response.body()), b'<ServerException>Project file error. For OWS services: please provide a SERVICE and a MAP parameter pointing to a valid QGIS project file</ServerException>\n')
344+
self.assertEqual(response.headers(), {'Content-Length': '156', 'Content-Type': 'text/xml; charset=utf-8'})
345345
self.assertEqual(response.statusCode(), 500)
346346

347347
def test_api(self):
@@ -350,23 +350,23 @@ def test_api(self):
350350
# Test as a whole
351351
header, body = self._execute_request("")
352352
response = self.strip_version_xmlns(header + body)
353-
expected = self.strip_version_xmlns(b'Content-Length: 54\nContent-Type: text/xml; charset=utf-8\n\n<ServerException>Project file error</ServerException>\n')
353+
expected = self.strip_version_xmlns(b'Content-Length: 156\nContent-Type: text/xml; charset=utf-8\n\n<ServerException>Project file error. For OWS services: please provide a SERVICE and a MAP parameter pointing to a valid QGIS project file</ServerException>\n')
354354
self.assertEqual(response, expected)
355-
expected = b'Content-Length: 54\nContent-Type: text/xml; charset=utf-8\n\n'
355+
expected = b'Content-Length: 156\nContent-Type: text/xml; charset=utf-8\n\n'
356356
self.assertEqual(header, expected)
357357

358358
# Test response when project is specified but without service
359359
project = self.testdata_path + "test_project_wfs.qgs"
360360
qs = '?MAP=%s' % (urllib.parse.quote(project))
361361
header, body = self._execute_request(qs)
362362
response = self.strip_version_xmlns(header + body)
363-
expected = self.strip_version_xmlns(b'Content-Length: 206\nContent-Type: text/xml; charset=utf-8\n\n<ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc">\n <ServiceException code="Service configuration error">Service unknown or unsupported</ServiceException>\n</ServiceExceptionReport>\n')
363+
expected = self.strip_version_xmlns(b'Content-Length: 326\nContent-Type: text/xml; charset=utf-8\n\n<ServiceExceptionReport >\n <ServiceException code="Service configuration error">Service unknown or unsupported. Current supported services (case-sensitive): WMS WFS WCS WMTS SampleService, or use a WFS3 (OGC API Features) endpoint</ServiceException>\n</ServiceExceptionReport>\n')
364364
self.assertEqual(response, expected)
365-
expected = b'Content-Length: 206\nContent-Type: text/xml; charset=utf-8\n\n'
365+
expected = b'Content-Length: 326\nContent-Type: text/xml; charset=utf-8\n\n'
366366
self.assertEqual(header, expected)
367367

368368
# Test body
369-
expected = self.strip_version_xmlns(b'<ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc">\n <ServiceException code="Service configuration error">Service unknown or unsupported</ServiceException>\n</ServiceExceptionReport>\n')
369+
expected = self.strip_version_xmlns(b'<ServiceExceptionReport >\n <ServiceException code="Service configuration error">Service unknown or unsupported. Current supported services (case-sensitive): WMS WFS WCS WMTS SampleService, or use a WFS3 (OGC API Features) endpoint</ServiceException>\n</ServiceExceptionReport>\n')
370370
self.assertEqual(self.strip_version_xmlns(body), expected)
371371

372372
# WCS tests

0 commit comments

Comments
 (0)
Please sign in to comment.