Coverage for gws-app/gws/plugin/ows_server/wms/_test/_test.py: 100%
15 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-16 23:09 +0200
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-16 23:09 +0200
1import gws
2import gws.test.util as u
3import gws.lib.xmlx.validator
6@u.fixture(scope='module')
7def root():
8 cfg = """
9 permissions.all "allow all"
11 actions [
12 { type "ows" }
13 ]
15 owsServices+ {
16 type "wms"
17 uid "WMS_1"
18 }
19 owsServices+ {
20 type "wms"
21 uid "WMS_1_INSPIRE"
22 withInspireMeta true
23 metadata {DEFAULT_METADATA}
24 }
25 projects+ {
26 uid "PROJECT_1"
27 metadata.abstract "ABSTRACT"
28 metadata.keywords ["aaa" "bbb"]
29 map.extent [0 0 100 200]
30 map.srs "EPSG:3857"
31 map.layers+ {
32 uid "LAYER_1"
33 title "LAYER_1"
34 type "raster"
35 provider.paths ["/gws-app/gws/plugin/ows_server/wms/_test/300x400.png"]
36 }
37 }
38 """
39 yield u.gws_root(cfg, DEFAULT_METADATA=u.DEFAULT_METADATA)
41def test_valid_GetCapabilities(root: gws.Root):
42 s = u.http.get(root, '/_/owsService', query_string={
43 'request': "GetCapabilities",
44 'serviceUid': "WMS_1",
45 'projectUid': "PROJECT_1",
46 'version': "1.3.0"
47 })
48 gws.u.write_file_b(f'{gws.c.VAR_DIR}/wms_GetCapabilities.xml', s.get_data())
49 assert gws.lib.xmlx.validator.validate(s.get_data())
51def test_valid_GetCapabilities_inspire(root: gws.Root):
52 s = u.http.get(root, '/_/owsService', query_string={
53 'request': "GetCapabilities",
54 'serviceUid': "WMS_1_INSPIRE",
55 'projectUid': "PROJECT_1",
56 'version': "1.3.0"
57 })
58 gws.u.write_file_b(f'{gws.c.VAR_DIR}/wms_GetCapabilities_inspire.xml', s.get_data())
59 assert gws.lib.xmlx.validator.validate(s.get_data())