@@ -116,6 +116,7 @@ async def test_nocollections(
116116):
117117 resp = await app_client .get ("/collections" )
118118 assert resp .status_code == 200
119+ assert resp .json ()["numberReturned" ] == 0
119120
120121
121122async def test_returns_valid_collection (app_client , load_test_data ):
@@ -168,6 +169,9 @@ async def test_returns_valid_links_in_collections(app_client, load_test_data):
168169 resp = await app_client .get ("/collections" )
169170 assert resp .status_code == 200
170171 resp_json = resp .json ()
172+ assert resp .json ()["numberReturned" ]
173+ assert resp .json ()["numberMatched" ]
174+
171175 collections = resp_json ["collections" ]
172176 # Find collection in list by ID
173177 single_coll = next (coll for coll in collections if coll ["id" ] == in_json ["id" ])
@@ -317,6 +321,8 @@ async def test_collection_search_freetext(
317321 "/collections" ,
318322 params = {"q" : "temperature" },
319323 )
324+ assert resp .json ()["numberReturned" ] == 1
325+ assert resp .json ()["numberMatched" ] == 1
320326 assert len (resp .json ()["collections" ]) == 1
321327 assert resp .json ()["collections" ][0 ]["id" ] == load_test2_collection .id
322328
@@ -341,13 +347,17 @@ async def test_all_collections_with_pagination(app_client, load_test_data):
341347 assert resp .status_code == 201
342348
343349 resp = await app_client .get ("/collections" )
350+ assert resp .json ()["numberReturned" ] == 10
351+ assert resp .json ()["numberMatched" ] == 12
344352 cols = resp .json ()["collections" ]
345353 assert len (cols ) == 10
346354 links = resp .json ()["links" ]
347355 assert len (links ) == 3
348356 assert {"root" , "self" , "next" } == {link ["rel" ] for link in links }
349357
350358 resp = await app_client .get ("/collections" , params = {"limit" : 12 })
359+ assert resp .json ()["numberReturned" ] == 12
360+ assert resp .json ()["numberMatched" ] == 12
351361 cols = resp .json ()["collections" ]
352362 assert len (cols ) == 12
353363 links = resp .json ()["links" ]
@@ -369,6 +379,8 @@ async def test_all_collections_without_pagination(app_client_no_ext, load_test_d
369379 assert resp .status_code == 201
370380
371381 resp = await app_client_no_ext .get ("/collections" )
382+ assert resp .json ()["numberReturned" ] == 12
383+ assert resp .json ()["numberMatched" ] == 12
372384 cols = resp .json ()["collections" ]
373385 assert len (cols ) == 12
374386 links = resp .json ()["links" ]
@@ -382,6 +394,8 @@ async def test_get_collections_search_pagination(
382394 app_client , load_test_collection , load_test2_collection
383395):
384396 resp = await app_client .get ("/collections" )
397+ assert resp .json ()["numberReturned" ] == 2
398+ assert resp .json ()["numberMatched" ] == 2
385399 cols = resp .json ()["collections" ]
386400 assert len (cols ) == 2
387401 links = resp .json ()["links" ]
0 commit comments