Skip to content
Permalink
Browse files
More tests for href
  • Loading branch information
elpaso authored and nyalldawson committed Nov 1, 2021
1 parent 77b3433 commit 8bc90ceefea8a2ef2fa18b71ffe0e11d3b6e3102
Showing with 10 additions and 5 deletions.
  1. +10 −5 tests/src/python/test_qgsserver_api.py
@@ -24,6 +24,7 @@
from qgis.server import (
QgsBufferServerRequest,
QgsBufferServerResponse,
QgsServer,
QgsServerApi,
QgsServerApiBadRequestException,
QgsServerQueryStringParameter,
@@ -2033,22 +2034,26 @@ def test_path_capture(self):
project = QgsProject()

api = QgsServerOgcApi(self.server.serverInterface(),
'/', 'apifour', 'a fourth api', '1.2')
'/services/api4', 'apifour', 'a fourth api', '1.2')

h4 = Handler4()
api.registerHandler(h4)

request = QgsBufferServerRequest(
'http://localhost:19876/tms/france_parts.json?MAP=france_parts')
'http://localhost:19876/services/api4/tms/france_parts.json?MAP=france_parts')
response = QgsBufferServerResponse()

ctx = QgsServerApiContext(
'/services/api4', request, response, project, self.server.serverInterface())
server = QgsServer()
iface = server.serverInterface()
iface.serviceRegistry().registerApi(api)

api.executeRequest(ctx)
server.handleRequest(request, response)

self.assertEqual(h4.params, {'tilemapid': 'france_parts.json'})

ctx = QgsServerApiContext(api.rootPath(), request, response, project, iface)
self.assertEqual(h4.href(ctx), 'http://localhost:19876/services/api4/tms/france_parts?MAP=france_parts')


if __name__ == '__main__':
unittest.main()

0 comments on commit 8bc90ce

Please sign in to comment.