From c870158ec39d2b3eda59acd3959fb25c8a34beb6 Mon Sep 17 00:00:00 2001 From: hrodmn Date: Wed, 22 Nov 2023 06:37:49 -0600 Subject: [PATCH] properly test datetime extents --- tests/conftest.py | 2 ++ tests/routes/test_collections.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 0d127a11..cdbb218a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -347,6 +347,7 @@ def app_no_extents(database_url, monkeypatch): schemas=["myschema", "public"], spatial_extent=False, datetime_extent=False, + only_spatial_tables=False, ) sql_settings = CustomSQLSettings(custom_sql_directory=SQL_FUNCTIONS_DIRECTORY) @@ -372,6 +373,7 @@ def app_no_spatial_extent(database_url, monkeypatch): schemas=["myschema", "public"], spatial_extent=False, datetime_extent=True, + only_spatial_tables=False, ) sql_settings = CustomSQLSettings(custom_sql_directory=SQL_FUNCTIONS_DIRECTORY) diff --git a/tests/routes/test_collections.py b/tests/routes/test_collections.py index 0aedf49c..39ac3344 100644 --- a/tests/routes/test_collections.py +++ b/tests/routes/test_collections.py @@ -299,6 +299,12 @@ def test_collections_no_extents(app_no_extents): ] # default value assert not body["extent"].get("temporal") + # check a table with datetime column + response = app_no_extents.get("/collections/public.nongeo_data") + assert response.status_code == 200 + body = response.json() + assert not body.get("extent") + def test_collections_no_spatial_extent(app_no_spatial_extent): """Test /collections endpoint.""" @@ -314,3 +320,10 @@ def test_collections_no_spatial_extent(app_no_spatial_extent): 90, ] ] + + # check a table with datetime column + response = app_no_spatial_extent.get("/collections/public.nongeo_data") + assert response.status_code == 200 + body = response.json() + assert not body["extent"].get("spatial") + assert body["extent"].get("temporal")