Skip to content

shows that ms are striped with =0 for GET request #779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions stac_fastapi/api/tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime as python_datetime
from typing import List, Optional, Union

import attr
Expand Down Expand Up @@ -141,7 +141,7 @@ def get_search(
ids: Optional[List[str]] = None,
bbox: Optional[List[NumType]] = None,
intersects: Optional[str] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: Optional[int] = 10,
filter: Optional[str] = None,
filter_crs: Optional[str] = None,
Expand Down Expand Up @@ -221,7 +221,7 @@ def get_search(
ids: Optional[List[str]] = None,
bbox: Optional[List[NumType]] = None,
intersects: Optional[str] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: Optional[int] = 10,
**kwargs,
) -> stac.ItemCollection:
Expand All @@ -247,7 +247,7 @@ def item_collection(
self,
collection_id: str,
bbox: Optional[List[Union[float, int]]] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: int = 10,
token: str = None,
**kwargs,
Expand Down Expand Up @@ -400,10 +400,11 @@ def get_search(
ids: Optional[List[str]] = None,
bbox: Optional[List[NumType]] = None,
intersects: Optional[str] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: Optional[int] = 10,
**kwargs,
):
assert isinstance(datetime, python_datetime)
return datetime

def get_item(self, item_id: str, collection_id: str, **kwargs) -> stac.Item:
Expand All @@ -419,7 +420,7 @@ def item_collection(
self,
collection_id: str,
bbox: Optional[List[Union[float, int]]] = None,
datetime: Optional[Union[str, datetime]] = None,
datetime: Optional[Union[str, python_datetime]] = None,
limit: int = 10,
token: str = None,
**kwargs,
Expand All @@ -439,16 +440,34 @@ def item_collection(
"datetime": "2020-01-01T00:00:00.00001Z",
},
)
get_search_zero = client.get(
"/search",
params={
"collections": ["test"],
"datetime": "2020-01-01T00:00:00.0000Z",
},
)
post_search = client.post(
"/search",
json={
"collections": ["test"],
"datetime": "2020-01-01T00:00:00.00001Z",
},
)
post_search_zero = client.post(
"/search",
json={
"collections": ["test"],
"datetime": "2020-01-01T00:00:00.0000Z",
},
)

assert get_search.status_code == 200, get_search.text
assert get_search.json() == "2020-01-01T00:00:00.000010+00:00"
assert get_search_zero.status_code == 200, get_search_zero.text
assert get_search_zero.json() == "2020-01-01T00:00:00+00:00"

assert post_search.status_code == 200, post_search.text
assert post_search.json() == "2020-01-01T00:00:00.00001Z"
assert post_search_zero.status_code == 200, post_search_zero.text
assert post_search_zero.json() == "2020-01-01T00:00:00.0000Z"
Loading