Coverage for gws-app/gws/plugin/ows_server/csw/_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 "csw"
17 uid "CSW_1"
18 withInspireMeta true
19 metadata {DEFAULT_METADATA}
20 }
22 helpers+ {
23 type "xml"
24 namespaces+ {
25 xmlns "demo"
26 uri "http://localhost/_/owsXml/namespace/demo"
27 }
28 }
30 projects+ {
31 uid "PROJECT_1"
32 metadata.abstract "ABSTRACT"
33 metadata.keywords ["aaa" "bbb"]
34 map.extent [0 0 100 200]
35 map.srs "EPSG:3857"
36 map.layers+ {
37 uid "LAYER_1"
38 title "LAYER_1"
39 type "geojson"
40 provider.path "/gws-app/gws/plugin/ows_server/wfs/_test/1.geojson"
41 ows.xmlns "demo"
42 withSearch true
43 }
44 }
45 """
47 yield u.gws_root(cfg, DEFAULT_METADATA=u.DEFAULT_METADATA)
50def test_valid_GetCapabilities(root: gws.Root):
51 s = u.http.get(
52 root,
53 '/_/owsService',
54 query_string={
55 'request': 'GetCapabilities',
56 'serviceUid': 'CSW_1',
57 },
58 )
59 gws.u.write_file_b(f'{gws.c.VAR_DIR}/csw_GetCapabilities.xml', s.get_data())
60 assert gws.lib.xmlx.validator.validate(s.get_data())
63def test_valid_GetRecords(root: gws.Root):
64 s = u.http.get(
65 root,
66 '/_/owsService',
67 query_string={
68 'request': 'GetRecords',
69 'serviceUid': 'CSW_1',
70 },
71 )
72 gws.u.write_file_b(f'{gws.c.VAR_DIR}/csw_GetRecords.xml', s.get_data())
73 assert gws.lib.xmlx.validator.validate(s.get_data())