From e930e859b9ea50773b085c203b74c6c9a751480f Mon Sep 17 00:00:00 2001 From: spencer <swilbur@usgs.gov> Date: Tue, 10 Dec 2024 11:46:44 -0700 Subject: [PATCH] Reverted test to allow strings for specifc parmaters. I believe I grabbed an old version of DataAPIQuery that caused the test to fail before. Things should now be up to date. --- geomagio/api/ws/DataApiQuery.py | 6 +++--- test/DataApiQuery_test.py | 6 +++--- test/FilterApiQuery_test.py | 6 +++--- test/api_test/ws_test/data_test.py | 4 ++-- test/api_test/ws_test/filter_test.py | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/geomagio/api/ws/DataApiQuery.py b/geomagio/api/ws/DataApiQuery.py index 06fff981..3d7a71c4 100644 --- a/geomagio/api/ws/DataApiQuery.py +++ b/geomagio/api/ws/DataApiQuery.py @@ -70,9 +70,9 @@ class DataApiQuery(BaseModel): endtime: Optional[CustomUTCDateTimeType] = None elements: List[str] = DEFAULT_ELEMENTS sampling_period: SamplingPeriod = SamplingPeriod.MINUTE - data_type: DataType = DataType.VARIATION - format: OutputFormat = OutputFormat.IAGA2002 - data_host: DataHost = DataHost.DEFAULT + data_type: Union[DataType, str] = DataType.VARIATION + format: Union[OutputFormat, str] = OutputFormat.IAGA2002 + data_host: Union[DataHost, str] = DataHost.DEFAULT @field_validator("starttime", mode="before") def validate_starttime( diff --git a/test/DataApiQuery_test.py b/test/DataApiQuery_test.py index 4434af7d..117f1758 100644 --- a/test/DataApiQuery_test.py +++ b/test/DataApiQuery_test.py @@ -65,9 +65,9 @@ def test_DataApiQuery_valid(): assert_equal(query.endtime, UTCDateTime("2024-09-01T01:00:01")) assert_equal(query.elements, ["F"]) assert_equal(query.sampling_period, SamplingPeriod.SECOND) - assert_equal(query.data_type, DataType.ADJUSTED) - assert_equal(query.format, OutputFormat.JSON) - assert_equal(query.data_host, DataHost.CWBPUB) + assert_equal(query.data_type, "adjusted") + assert_equal(query.format, "json") + assert_equal(query.data_host, "cwbpub.cr.usgs.gov") def test_DataApiQuery_no_id(): diff --git a/test/FilterApiQuery_test.py b/test/FilterApiQuery_test.py index b6a4dc04..6393297a 100644 --- a/test/FilterApiQuery_test.py +++ b/test/FilterApiQuery_test.py @@ -48,9 +48,9 @@ def test_FilterApiQuery_valid(): assert_equal(query.elements, ["Z"]) assert_equal(query.input_sampling_period, SamplingPeriod.MINUTE) assert_equal(query.sampling_period, SamplingPeriod.HOUR) - assert_equal(query.data_type, DataType.ADJUSTED) - assert_equal(query.format, OutputFormat.JSON) - assert_equal(query.data_host, DataHost.CWBPUB) + assert_equal(query.data_type, "adjusted") + assert_equal(query.format, "json") + assert_equal(query.data_host, "cwbpub.cr.usgs.gov") def test_FilterApiQuery_no_id(): diff --git a/test/api_test/ws_test/data_test.py b/test/api_test/ws_test/data_test.py index 96fba2f0..9a3da337 100644 --- a/test/api_test/ws_test/data_test.py +++ b/test/api_test/ws_test/data_test.py @@ -36,8 +36,8 @@ def test_get_data_query(test_client): assert_equal(query.endtime, UTCDateTime("2020-09-02T00:00:00.999")) assert_equal(query.elements, ["X", "Y", "Z", "F"]) assert_equal(query.sampling_period, SamplingPeriod.MINUTE) - assert_equal(query.format, OutputFormat.IAGA2002) - assert_equal(query.data_type, DataType.VARIATION) + assert_equal(query.format, "iaga2002") + assert_equal(query.data_type, "variation") def test_get_data_query_no_starttime(test_client): diff --git a/test/api_test/ws_test/filter_test.py b/test/api_test/ws_test/filter_test.py index 470e8474..aa0a4d8f 100644 --- a/test/api_test/ws_test/filter_test.py +++ b/test/api_test/ws_test/filter_test.py @@ -31,8 +31,8 @@ def test_get_filter_data_query(test_client): assert_equal(query.starttime, UTCDateTime("2020-09-01T00:00:01")) assert_equal(query.endtime, UTCDateTime("2020-09-02T00:00:00.999")) assert_equal(query.elements, ["X", "Y", "Z", "F"]) - assert_equal(query.format, OutputFormat.IAGA2002) - assert_equal(query.data_type, DataType.VARIATION) + assert_equal(query.format, "iaga2002") + assert_equal(query.data_type, "variation") assert_equal(query.input_sampling_period, SamplingPeriod.MINUTE) assert_equal(query.output_sampling_period, SamplingPeriod.HOUR) -- GitLab