77
88
99@pytest .mark .asyncio
10- async def test_aggregation_extension_landing_page_link (app_client , ctx ):
10+ async def test_aggregation_extension_landing_page_link (app_client ):
1111 """Test if the `aggregations` and `aggregate` links are included in the landing page"""
1212 resp = await app_client .get ("/" )
1313 assert resp .status_code == 200
@@ -20,23 +20,15 @@ async def test_aggregation_extension_landing_page_link(app_client, ctx):
2020
2121
2222@pytest .mark .asyncio
23- async def test_aggregation_extension_collection_link (app_client , ctx , load_test_data ):
23+ async def test_aggregation_extension_collection_link (app_client , ctx ):
2424 """Test if the `aggregations` and `aggregate` links are included in the collection links"""
25- test_collection = load_test_data ("test_collection.json" )
26- test_collection ["id" ] = "test"
2725
28- resp = await app_client .post ("/collections" , json = test_collection )
29- assert resp .status_code == 201
30-
31- resp = await app_client .get (f"/collections/{ test_collection ['id' ]} " )
26+ resp = await app_client .get (f"/collections/{ ctx .collection ['id' ]} " )
3227 resp_json = resp .json ()
3328 keys = [link ["rel" ] for link in resp_json ["links" ]]
3429 assert "aggregations" in keys
3530 assert "aggregate" in keys
3631
37- resp = await app_client .delete (f"/collections/{ test_collection ['id' ]} " )
38- assert resp .status_code == 204
39-
4032
4133@pytest .mark .asyncio
4234async def test_get_catalog_aggregations (app_client ):
@@ -57,49 +49,31 @@ async def test_post_catalog_aggregations(app_client):
5749
5850
5951@pytest .mark .asyncio
60- async def test_get_collection_aggregations (app_client , ctx , load_test_data ):
52+ async def test_get_collection_aggregations (app_client , ctx ):
6153 # there's one item that can match, so one of these queries should match it and the other shouldn't
6254
63- test_collection = load_test_data ("test_collection.json" )
64- test_collection ["id" ] = "test"
65-
66- resp = await app_client .post ("/collections" , json = test_collection )
67- assert resp .status_code == 201
68-
69- resp = await app_client .get (f"/collections/{ test_collection ['id' ]} /aggregations" )
55+ resp = await app_client .get (f"/collections/{ ctx .collection ['id' ]} /aggregations" )
7056 assert resp .status_code == 200
7157 assert len (resp .json ()["aggregations" ]) == 15
7258 rj = resp .json ()
7359 href_self = urlparse (
7460 next (link ["href" ] for link in rj ["links" ] if link ["rel" ] == "self" )
7561 )
76- assert href_self .path == f"/collections/{ test_collection ['id' ]} /aggregations"
77-
78- resp = await app_client .delete (f"/collections/{ test_collection ['id' ]} " )
79- assert resp .status_code == 204
62+ assert href_self .path == f"/collections/{ ctx .collection ['id' ]} /aggregations"
8063
8164
8265@pytest .mark .asyncio
83- async def test_post_collection_aggregations (app_client , ctx , load_test_data ):
66+ async def test_post_collection_aggregations (app_client , ctx ):
8467 # there's one item that can match, so one of these queries should match it and the other shouldn't
8568
86- test_collection = load_test_data ("test_collection.json" )
87- test_collection ["id" ] = "test"
88-
89- resp = await app_client .post ("/collections" , json = test_collection )
90- assert resp .status_code == 201
91-
92- resp = await app_client .post (f"/collections/{ test_collection ['id' ]} /aggregations" )
69+ resp = await app_client .post (f"/collections/{ ctx .collection ['id' ]} /aggregations" )
9370 assert resp .status_code == 200
9471 assert len (resp .json ()["aggregations" ]) == 15
9572 rj = resp .json ()
9673 href_self = urlparse (
9774 next (link ["href" ] for link in rj ["links" ] if link ["rel" ] == "self" )
9875 )
99- assert href_self .path == f"/collections/{ test_collection ['id' ]} /aggregations"
100-
101- resp = await app_client .delete (f"/collections/{ test_collection ['id' ]} " )
102- assert resp .status_code == 204
76+ assert href_self .path == f"/collections/{ ctx .collection ['id' ]} /aggregations"
10377
10478
10579@pytest .mark .asyncio
@@ -119,7 +93,7 @@ async def test_aggregate_search_point_does_not_intersect(app_client, ctx):
11993
12094
12195@pytest .mark .asyncio
122- async def test_get_collection_aggregate_no_collection (app_client , ctx , load_test_data ):
96+ async def test_get_collection_aggregate_no_collection (app_client ):
12397
12498 resp = await app_client .get (
12599 "/collections/not-a-collection/aggregate?aggregations=total_count"
@@ -128,33 +102,31 @@ async def test_get_collection_aggregate_no_collection(app_client, ctx, load_test
128102
129103
130104@pytest .mark .asyncio
131- async def test_get_collection_aggregate (app_client , ctx , load_test_data ):
132- test_collection = load_test_data ("test_collection.json" )
105+ async def test_get_collection_aggregate (app_client , ctx ):
133106
134107 resp = await app_client .get (
135- f"/collections/{ test_collection ['id' ]} /aggregate?aggregations=total_count"
108+ f"/collections/{ ctx . collection ['id' ]} /aggregate?aggregations=total_count"
136109 )
137110 assert resp .status_code == 200
138111 assert resp .json ()["aggregations" ][0 ]["value" ] == 1
139112
140113
141114@pytest .mark .asyncio
142- async def test_post_collection_aggregate (app_client , ctx , load_test_data ):
143- test_collection = load_test_data ("test_collection.json" )
115+ async def test_post_collection_aggregate (app_client , ctx ):
144116
145117 params = {
146118 "aggregations" : ["total_count" ],
147119 }
148120
149121 resp = await app_client .post (
150- f"/collections/{ test_collection ['id' ]} /aggregate" , json = params
122+ f"/collections/{ ctx . collection ['id' ]} /aggregate" , json = params
151123 )
152124 assert resp .status_code == 200
153125 assert resp .json ()["aggregations" ][0 ]["value" ] == 1
154126
155127
156128@pytest .mark .asyncio
157- async def test_aggregate_datetime_out_of_range (app_client , ctx ):
129+ async def test_aggregate_datetime_out_of_range (app_client ):
158130 params = {
159131 "datetime" : "2023-07-14T02:05:01.324Z/2024-02-28T23:13:08.000Z" ,
160132 "aggregations" : ["total_count" ],
@@ -165,7 +137,7 @@ async def test_aggregate_datetime_out_of_range(app_client, ctx):
165137
166138
167139@pytest .mark .asyncio
168- async def test_aggregate_datetime_in_range (app_client , ctx ):
140+ async def test_aggregate_datetime_in_range (app_client ):
169141 params = {
170142 "datetime" : "2020-02-11T12:30:22Z/2020-02-13T12:30:22Z" ,
171143 "aggregations" : ["total_count" ],
@@ -201,7 +173,7 @@ async def test_aggregate_filter_extension_neq_post(app_client, ctx):
201173
202174
203175@pytest .mark .asyncio
204- async def test_aggregate_extension_gte_get (app_client , ctx ):
176+ async def test_aggregate_extension_gte_get (app_client ):
205177 # there's one item that can match, so one of these queries should match it and the other shouldn't
206178 resp = await app_client .get (
207179 '/aggregate?aggregations=total_count&filter-lang=cql2-json&filter={"op":"<=","args":[{"property": "properties.proj:epsg"},32756]}'
@@ -396,7 +368,7 @@ async def test_aggregate_filter_extension_in_no_list(app_client, ctx):
396368
397369
398370@pytest .mark .asyncio
399- async def test_aggregate_datetime_non_interval (app_client , ctx ):
371+ async def test_aggregate_datetime_non_interval (app_client ):
400372 dt_formats = [
401373 "2020-02-12T12:30:22+00:00" ,
402374 "2020-02-12T12:30:22.00Z" ,
@@ -413,7 +385,7 @@ async def test_aggregate_datetime_non_interval(app_client, ctx):
413385
414386
415387@pytest .mark .asyncio
416- async def test_post_aggregate_total_count (app_client , ctx ):
388+ async def test_post_aggregate_total_count (app_client ):
417389
418390 params = {
419391 "aggregations" : ["total_count" ],
@@ -426,7 +398,7 @@ async def test_post_aggregate_total_count(app_client, ctx):
426398
427399
428400@pytest .mark .asyncio
429- async def test_get_aggregate_total_count (app_client , ctx ):
401+ async def test_get_aggregate_total_count (app_client ):
430402
431403 resp = await app_client .get ("/aggregate?aggregations=total_count" )
432404
@@ -435,7 +407,7 @@ async def test_get_aggregate_total_count(app_client, ctx):
435407
436408
437409@pytest .mark .asyncio
438- async def test_get_aggregate_datetime_max (app_client , ctx ):
410+ async def test_get_aggregate_datetime_max (app_client ):
439411
440412 resp = await app_client .get ("/aggregate?aggregations=datetime_max" )
441413
@@ -447,7 +419,7 @@ async def test_get_aggregate_datetime_max(app_client, ctx):
447419
448420
449421@pytest .mark .asyncio
450- async def test_post_aggregate_datetime_max (app_client , ctx ):
422+ async def test_post_aggregate_datetime_max (app_client ):
451423
452424 params = {
453425 "aggregations" : ["datetime_max" ],
@@ -463,7 +435,7 @@ async def test_post_aggregate_datetime_max(app_client, ctx):
463435
464436
465437@pytest .mark .asyncio
466- async def test_get_aggregate_datetime_min (app_client , ctx ):
438+ async def test_get_aggregate_datetime_min (app_client ):
467439
468440 resp = await app_client .get ("/aggregate?aggregations=datetime_min" )
469441
@@ -475,7 +447,7 @@ async def test_get_aggregate_datetime_min(app_client, ctx):
475447
476448
477449@pytest .mark .asyncio
478- async def test_post_aggregate_datetime_min (app_client , ctx ):
450+ async def test_post_aggregate_datetime_min (app_client ):
479451
480452 params = {
481453 "aggregations" : ["datetime_min" ],
@@ -491,7 +463,7 @@ async def test_post_aggregate_datetime_min(app_client, ctx):
491463
492464
493465@pytest .mark .asyncio
494- async def test_get_aggregate_datetime_frequency (app_client , ctx ):
466+ async def test_get_aggregate_datetime_frequency (app_client ):
495467
496468 resp = await app_client .get ("/aggregate?aggregations=datetime_frequency" )
497469
@@ -504,7 +476,7 @@ async def test_get_aggregate_datetime_frequency(app_client, ctx):
504476
505477
506478@pytest .mark .asyncio
507- async def test_post_aggregate_datetime_frequency (app_client , ctx ):
479+ async def test_post_aggregate_datetime_frequency (app_client ):
508480
509481 params = {
510482 "aggregations" : ["datetime_frequency" ],
@@ -521,7 +493,7 @@ async def test_post_aggregate_datetime_frequency(app_client, ctx):
521493
522494
523495@pytest .mark .asyncio
524- async def test_get_aggregate_collection_frequency (app_client , ctx ):
496+ async def test_get_aggregate_collection_frequency (app_client ):
525497
526498 resp = await app_client .get ("/aggregate?aggregations=collection_frequency" )
527499
@@ -531,7 +503,7 @@ async def test_get_aggregate_collection_frequency(app_client, ctx):
531503
532504
533505@pytest .mark .asyncio
534- async def test_post_aggregate_collection_frequency (app_client , ctx ):
506+ async def test_post_aggregate_collection_frequency (app_client ):
535507
536508 params = {
537509 "aggregations" : ["collection_frequency" ],
@@ -572,7 +544,7 @@ async def test_post_aggregate_attribute_frequency(app_client, ctx):
572544
573545
574546@pytest .mark .asyncio
575- async def test_post_aggregate_unsupported_aggregation (app_client , ctx ):
547+ async def test_post_aggregate_unsupported_aggregation (app_client ):
576548
577549 params = {
578550 "aggregations" : ["this_is_not_an_aggregation" ],
@@ -597,7 +569,7 @@ async def test_post_aggregate_unsupported_collection_aggregation(app_client, ctx
597569
598570
599571@pytest .mark .asyncio
600- async def test_get_aggregate_precision_outside_range (app_client , ctx ):
572+ async def test_get_aggregate_precision_outside_range (app_client ):
601573
602574 resp = await app_client .get (
603575 "/aggregate?aggregations=centroid_geohash_grid_frequency¢roid_geohash_grid_frequency_precision=55"
0 commit comments