@@ -77,7 +77,7 @@ def test_conformance(config):
7777 content = json .loads (content )
7878
7979 assert headers ['Content-Type' ] == 'application/json'
80- assert len (content ['conformsTo' ]) == 14
80+ assert len (content ['conformsTo' ]) == 16
8181
8282
8383def test_collections (config ):
@@ -113,10 +113,34 @@ def test_queryables(config):
113113 assert 'geometry' in content ['properties' ]
114114 assert content ['properties' ]['geometry' ]['$ref' ] == 'https://geojson.org/schema/Polygon.json' # noqa
115115
116+ assert content ['properties' ]['type' ]['facet' ] # test is truthy
117+
116118 headers , status , content = api .queryables ({}, {}, collection = 'foo' )
117119 assert status == 400
118120
119121
122+ def test_facets (config ):
123+ api = API (config )
124+ headers , status , content = api .facets_ ({}, {})
125+ content = json .loads (content )
126+
127+ assert headers ['Content-Type' ] == 'application/facets+json'
128+ assert content ['type' ] == 'object'
129+ assert content ['title' ] == 'pycsw Geospatial Catalogue'
130+ assert content ['$id' ] == 'http://localhost/pycsw/oarec/collections/metadata:main/facets' # noqa
131+ assert content ['$schema' ] == 'http://json-schema.org/draft/2019-09/schema'
132+
133+ assert len (content ['facets' ]) == 1
134+
135+ assert 'type' in content ['facets' ]
136+ assert content ['facets' ]['type' ]['type' ] == 'term'
137+ assert content ['facets' ]['type' ]['property' ] == 'type'
138+ assert content ['facets' ]['type' ]['sortedBy' ] == 'count'
139+
140+ headers , status , content = api .facets_ ({}, {}, collection = 'foo' )
141+ assert status == 400
142+
143+
120144def test_items (config ):
121145 api = API (config )
122146 headers , status , content = api .items ({}, None , {})
0 commit comments