@@ -116,6 +116,7 @@ async def test_nocollections(
116
116
):
117
117
resp = await app_client .get ("/collections" )
118
118
assert resp .status_code == 200
119
+ assert resp .json ()["numberReturned" ] == 0
119
120
120
121
121
122
async 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):
168
169
resp = await app_client .get ("/collections" )
169
170
assert resp .status_code == 200
170
171
resp_json = resp .json ()
172
+ assert resp .json ()["numberReturned" ]
173
+ assert resp .json ()["numberMatched" ]
174
+
171
175
collections = resp_json ["collections" ]
172
176
# Find collection in list by ID
173
177
single_coll = next (coll for coll in collections if coll ["id" ] == in_json ["id" ])
@@ -317,6 +321,8 @@ async def test_collection_search_freetext(
317
321
"/collections" ,
318
322
params = {"q" : "temperature" },
319
323
)
324
+ assert resp .json ()["numberReturned" ] == 1
325
+ assert resp .json ()["numberMatched" ] == 1
320
326
assert len (resp .json ()["collections" ]) == 1
321
327
assert resp .json ()["collections" ][0 ]["id" ] == load_test2_collection .id
322
328
@@ -341,13 +347,17 @@ async def test_all_collections_with_pagination(app_client, load_test_data):
341
347
assert resp .status_code == 201
342
348
343
349
resp = await app_client .get ("/collections" )
350
+ assert resp .json ()["numberReturned" ] == 10
351
+ assert resp .json ()["numberMatched" ] == 12
344
352
cols = resp .json ()["collections" ]
345
353
assert len (cols ) == 10
346
354
links = resp .json ()["links" ]
347
355
assert len (links ) == 3
348
356
assert {"root" , "self" , "next" } == {link ["rel" ] for link in links }
349
357
350
358
resp = await app_client .get ("/collections" , params = {"limit" : 12 })
359
+ assert resp .json ()["numberReturned" ] == 12
360
+ assert resp .json ()["numberMatched" ] == 12
351
361
cols = resp .json ()["collections" ]
352
362
assert len (cols ) == 12
353
363
links = resp .json ()["links" ]
@@ -369,6 +379,8 @@ async def test_all_collections_without_pagination(app_client_no_ext, load_test_d
369
379
assert resp .status_code == 201
370
380
371
381
resp = await app_client_no_ext .get ("/collections" )
382
+ assert resp .json ()["numberReturned" ] == 12
383
+ assert resp .json ()["numberMatched" ] == 12
372
384
cols = resp .json ()["collections" ]
373
385
assert len (cols ) == 12
374
386
links = resp .json ()["links" ]
@@ -382,6 +394,8 @@ async def test_get_collections_search_pagination(
382
394
app_client , load_test_collection , load_test2_collection
383
395
):
384
396
resp = await app_client .get ("/collections" )
397
+ assert resp .json ()["numberReturned" ] == 2
398
+ assert resp .json ()["numberMatched" ] == 2
385
399
cols = resp .json ()["collections" ]
386
400
assert len (cols ) == 2
387
401
links = resp .json ()["links" ]
0 commit comments