Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More tests for href
  • Loading branch information
elpaso committed Oct 8, 2021
1 parent a7a6865 commit 2560f0f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/src/python/test_qgsserver_api.py
Expand Up @@ -24,6 +24,7 @@
from qgis.server import (
QgsBufferServerRequest,
QgsBufferServerResponse,
QgsServer,
QgsServerApi,
QgsServerApiBadRequestException,
QgsServerQueryStringParameter,
Expand Down Expand Up @@ -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 2560f0f

Please sign in to comment.