Skip to content

Commit 2ff9c9f

Browse files
committed
test fixes
1 parent 3029513 commit 2ff9c9f

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

stac_fastapi/tests/conftest.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
from stac_fastapi.core.extensions import QueryExtension
1919

2020
if os.getenv("BACKEND", "elasticsearch").lower() == "opensearch":
21+
from stac_fastapi.opensearch.basic_auth import apply_basic_auth
2122
from stac_fastapi.opensearch.config import AsyncOpensearchSettings as AsyncSettings
2223
from stac_fastapi.opensearch.config import OpensearchSettings as SearchSettings
2324
from stac_fastapi.opensearch.database_logic import (
2425
DatabaseLogic,
2526
create_collection_index,
2627
create_index_templates,
2728
)
28-
from stac_fastapi.opensearch.basic_auth import apply_basic_auth
2929
else:
3030
from stac_fastapi.elasticsearch.config import (
3131
ElasticsearchSettings as SearchSettings,
@@ -258,10 +258,34 @@ async def app_basic_auth():
258258
search_get_request_model=create_get_request_model(extensions),
259259
search_post_request_model=post_request_model,
260260
)
261-
262-
os.environ["BASIC_AUTH"] = '{"public_endpoints":[{"path":"/","method":"GET"},{"path":"/search","method":"GET"}],"users":[{"username":"admin","password":"admin","permissions":"*"},{"username":"reader","password":"reader","permissions":[{"path":"/conformance","method":["GET"]},{"path":"/collections/{collection_id}/items/{item_id}","method":["GET"]},{"path":"/search","method":["POST"]},{"path":"/collections","method":["GET"]},{"path":"/collections/{collection_id}","method":["GET"]},{"path":"/collections/{collection_id}/items","method":["GET"]},{"path":"/queryables","method":["GET"]},{"path":"/queryables/collections/{collection_id}/queryables","method":["GET"]},{"path":"/_mgmt/ping","method":["GET"]}]}]}'
261+
262+
os.environ[
263+
"BASIC_AUTH"
264+
] = """{
265+
"public_endpoints": [
266+
{"path": "/", "method": "GET"},
267+
{"path": "/search", "method": "GET"}
268+
],
269+
"users": [
270+
{"username": "admin", "password": "admin", "permissions": "*"},
271+
{
272+
"username": "reader", "password": "reader",
273+
"permissions": [
274+
{"path": "/conformance", "method": ["GET"]},
275+
{"path": "/collections/{collection_id}/items/{item_id}", "method": ["GET"]},
276+
{"path": "/search", "method": ["POST"]},
277+
{"path": "/collections", "method": ["GET"]},
278+
{"path": "/collections/{collection_id}", "method": ["GET"]},
279+
{"path": "/collections/{collection_id}/items", "method": ["GET"]},
280+
{"path": "/queryables", "method": ["GET"]},
281+
{"path": "/queryables/collections/{collection_id}/queryables", "method": ["GET"]},
282+
{"path": "/_mgmt/ping", "method": ["GET"]}
283+
]
284+
}
285+
]
286+
}"""
263287
apply_basic_auth(stac_api)
264-
288+
265289
return stac_api.app
266290

267291

0 commit comments

Comments
 (0)