stac-fastapi.api 2.5.3__tar.gz → 2.5.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/PKG-INFO +1 -1
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/models.py +2 -2
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/version.py +1 -1
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi.api.egg-info/PKG-INFO +1 -1
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi.api.egg-info/SOURCES.txt +1 -0
- stac_fastapi_api-2.5.5/tests/test_app_prefix.py +66 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/README.md +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/setup.cfg +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/setup.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/__init__.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/app.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/config.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/errors.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/middleware.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/openapi.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi/api/routes.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi.api.egg-info/dependency_links.txt +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi.api.egg-info/not-zip-safe +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi.api.egg-info/requires.txt +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi.api.egg-info/top_level.txt +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/tests/test_api.py +0 -0
- {stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/tests/test_middleware.py +0 -0
|
@@ -103,14 +103,14 @@ def create_post_request_model(
|
|
|
103
103
|
|
|
104
104
|
@attr.s # type:ignore
|
|
105
105
|
class CollectionUri(APIRequest):
|
|
106
|
-
"""
|
|
106
|
+
"""Get or delete collection."""
|
|
107
107
|
|
|
108
108
|
collection_id: str = attr.ib(default=Path(..., description="Collection ID"))
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
@attr.s
|
|
112
112
|
class ItemUri(CollectionUri):
|
|
113
|
-
"""
|
|
113
|
+
"""Get or delete item."""
|
|
114
114
|
|
|
115
115
|
item_id: str = attr.ib(default=Path(..., description="Item ID"))
|
|
116
116
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Library version."""
|
|
2
|
-
__version__ = "2.5.
|
|
2
|
+
__version__ = "2.5.5"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import urllib
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
from fastapi import APIRouter
|
|
6
|
+
from starlette.testclient import TestClient
|
|
7
|
+
|
|
8
|
+
from stac_fastapi.api.app import StacApi
|
|
9
|
+
from stac_fastapi.types.config import ApiSettings
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_link(landing_page, rel_type, method: Optional[str] = None):
|
|
13
|
+
return next(
|
|
14
|
+
filter(
|
|
15
|
+
lambda link: link["rel"] == rel_type
|
|
16
|
+
and (not method or link.get("method") == method),
|
|
17
|
+
landing_page["links"],
|
|
18
|
+
),
|
|
19
|
+
None,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.mark.parametrize("prefix", ["", "/a_prefix"])
|
|
24
|
+
def test_api_prefix(TestCoreClient, prefix):
|
|
25
|
+
api_settings = ApiSettings(
|
|
26
|
+
openapi_url=f"{prefix}/api",
|
|
27
|
+
docs_url=f"{prefix}/api.html",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
api = StacApi(
|
|
31
|
+
settings=api_settings,
|
|
32
|
+
client=TestCoreClient(),
|
|
33
|
+
router=APIRouter(prefix=prefix),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
with TestClient(api.app, base_url="http://stac.io") as client:
|
|
37
|
+
landing = client.get(f"{prefix}/")
|
|
38
|
+
assert landing.status_code == 200, landing.json()
|
|
39
|
+
|
|
40
|
+
service_doc = client.get(f"{prefix}/api.html")
|
|
41
|
+
assert service_doc.status_code == 200, service_doc.text
|
|
42
|
+
|
|
43
|
+
service_desc = client.get(f"{prefix}/api")
|
|
44
|
+
assert service_desc.status_code == 200, service_desc.json()
|
|
45
|
+
|
|
46
|
+
conformance = client.get(f"{prefix}/conformance")
|
|
47
|
+
assert conformance.status_code == 200, conformance.json()
|
|
48
|
+
|
|
49
|
+
link_tests = [
|
|
50
|
+
("root", "application/json", "/"),
|
|
51
|
+
("conformance", "application/json", "/conformance"),
|
|
52
|
+
("service-doc", "text/html", "/api.html"),
|
|
53
|
+
("service-desc", "application/vnd.oai.openapi+json;version=3.0", "/api"),
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
for rel_type, expected_media_type, expected_path in link_tests:
|
|
57
|
+
link = get_link(landing.json(), rel_type)
|
|
58
|
+
|
|
59
|
+
assert link is not None, f"Missing {rel_type} link in landing page"
|
|
60
|
+
assert link.get("type") == expected_media_type
|
|
61
|
+
|
|
62
|
+
link_path = urllib.parse.urlsplit(link.get("href")).path
|
|
63
|
+
assert link_path == prefix + expected_path
|
|
64
|
+
|
|
65
|
+
resp = client.get(prefix + expected_path)
|
|
66
|
+
assert resp.status_code == 200
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stac_fastapi_api-2.5.3 → stac_fastapi_api-2.5.5}/stac_fastapi.api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|