|
18 | 18 | CoreClient, |
19 | 19 | TransactionsClient, |
20 | 20 | ) |
| 21 | +from stac_fastapi.core.extensions import QueryExtension |
| 22 | +from stac_fastapi.core.extensions.aggregation import ( |
| 23 | + EsAggregationExtensionGetRequest, |
| 24 | + EsAggregationExtensionPostRequest, |
| 25 | +) |
21 | 26 | from stac_fastapi.core.rate_limit import setup_rate_limit |
22 | 27 | from stac_fastapi.core.utilities import get_bool_env |
23 | 28 | from stac_fastapi.sfeos_helpers.aggregation import EsAsyncBaseAggregationClient |
|
46 | 51 | create_index_templates, |
47 | 52 | ) |
48 | 53 |
|
49 | | -from stac_fastapi.extensions.core import TransactionExtension |
| 54 | +from stac_fastapi.extensions.core import ( |
| 55 | + AggregationExtension, |
| 56 | + FieldsExtension, |
| 57 | + FilterExtension, |
| 58 | + FreeTextExtension, |
| 59 | + SortExtension, |
| 60 | + TokenPaginationExtension, |
| 61 | + TransactionExtension, |
| 62 | +) |
50 | 63 | from stac_fastapi.types.config import Settings |
51 | 64 |
|
52 | 65 | DATA_DIR = os.path.join(os.path.dirname(__file__), "data") |
@@ -330,7 +343,7 @@ async def route_dependencies_client(route_dependencies_app): |
330 | 343 |
|
331 | 344 | def build_test_app(): |
332 | 345 | """Build a test app with configurable transaction extensions.""" |
333 | | - # Create a copy of the base config which already has all extensions configured |
| 346 | + # Create a copy of the base config |
334 | 347 | test_config = app_config.copy() |
335 | 348 |
|
336 | 349 | # Get transaction extensions setting |
@@ -359,23 +372,27 @@ def build_test_app(): |
359 | 372 |
|
360 | 373 | # Add transaction extension if enabled |
361 | 374 | if TRANSACTIONS_EXTENSIONS: |
362 | | - settings = AsyncSettings() |
363 | | - test_config["extensions"].extend( |
364 | | - [ |
365 | | - TransactionExtension( |
366 | | - client=TransactionsClient( |
367 | | - database=database, session=None, settings=settings |
368 | | - ), |
369 | | - settings=settings, |
370 | | - ), |
371 | | - BulkTransactionExtension( |
372 | | - client=BulkTransactionsClient( |
373 | | - database=database, session=None, settings=settings |
374 | | - ) |
| 375 | + search_extensions.append( |
| 376 | + TransactionExtension( |
| 377 | + client=TransactionsClient( |
| 378 | + database=database, session=None, settings=settings |
375 | 379 | ), |
376 | | - ] |
| 380 | + settings=settings, |
| 381 | + ) |
377 | 382 | ) |
378 | 383 |
|
| 384 | + # Update extensions in config |
| 385 | + extensions = [aggregation_extension] + search_extensions |
| 386 | + test_config["extensions"] = extensions |
| 387 | + |
| 388 | + # Update client with new extensions |
| 389 | + test_config["client"] = CoreClient( |
| 390 | + database=database, |
| 391 | + session=None, |
| 392 | + extensions=extensions, |
| 393 | + post_request_model=test_config["search_post_request_model"], |
| 394 | + ) |
| 395 | + |
379 | 396 | # Create and return the app |
380 | 397 | api = StacApi(**test_config) |
381 | 398 | return api.app |
0 commit comments