File tree Expand file tree Collapse file tree 2 files changed +23
-19
lines changed Expand file tree Collapse file tree 2 files changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -457,27 +457,17 @@ async def test_item_search_temporal_window_post(
457
457
async def test_item_search_temporal_open_window (
458
458
app_client , load_test_data , load_test_collection
459
459
):
460
- """Test POST search with open spatio-temporal query (core)"""
461
- test_item = load_test_data ("test_item.json" )
462
- resp = await app_client .post (
463
- f"/collections/{ test_item ['collection' ]} /items" , json = test_item
464
- )
465
- assert resp .status_code == 200
466
-
467
- # Add second item with a different datetime.
468
- second_test_item = load_test_data ("test_item2.json" )
469
- resp = await app_client .post (
470
- f"/collections/{ test_item ['collection' ]} /items" , json = second_test_item
471
- )
472
- assert resp .status_code == 200
473
-
474
460
params = {
475
- "collections" : [test_item ["collection" ]],
476
461
"datetime" : "../.." ,
477
462
}
478
463
resp = await app_client .post ("/search" , json = params )
479
- resp_json = resp .json ()
480
- assert len (resp_json ["features" ]) == 2
464
+ assert resp .status_code == 400
465
+
466
+ params = {
467
+ "datetime" : "/" ,
468
+ }
469
+ resp = await app_client .post ("/search" , json = params )
470
+ assert resp .status_code == 400
481
471
482
472
483
473
@pytest .mark .asyncio
Original file line number Diff line number Diff line change
1
+ from datetime import timezone
2
+
1
3
import pytest
2
4
3
- from stac_fastapi .types .rfc3339 import rfc3339_str_to_datetime , str_to_interval
5
+ from stac_fastapi .types .rfc3339 import (
6
+ now_in_utc ,
7
+ now_to_rfc3339_str ,
8
+ rfc3339_str_to_datetime ,
9
+ str_to_interval ,
10
+ )
4
11
5
12
invalid_datetimes = [
6
13
"1985-04-12" , # date only
@@ -88,4 +95,11 @@ def test_parse_valid_interval_to_datetime(test_input):
88
95
assert str_to_interval (test_input )
89
96
90
97
91
- # TODO: add tests for now and str functions
98
+ def test_now_functions () -> None :
99
+ now1 = now_in_utc ()
100
+ now2 = now_in_utc ()
101
+
102
+ assert now1 < now2
103
+ assert now1 .tzinfo == timezone .utc
104
+
105
+ rfc3339_str_to_datetime (now_to_rfc3339_str ())
You can’t perform that action at this time.
0 commit comments