From f021cf98cdcea3e8cb0c3b5dbb5f3e4eea95b0ef Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Thu, 26 Sep 2019 09:59:45 -0400 Subject: [PATCH] ignore datetime parameter if collection is not time enabled (#252) (#254) --- pygeoapi/api.py | 3 ++- tests/test_api.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pygeoapi/api.py b/pygeoapi/api.py index 7c55609..232d209 100644 --- a/pygeoapi/api.py +++ b/pygeoapi/api.py @@ -478,7 +478,8 @@ class API(object): datetime_ = args.get('datetime') datetime_invalid = False - if datetime_ is not None: + if (datetime_ is not None and + 'temporal' in self.config['datasets'][dataset]['extents']): te = self.config['datasets'][dataset]['extents']['temporal'] if '/' in datetime_: # envelope diff --git a/tests/test_api.py b/tests/test_api.py index 434deeb..f42d090 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -285,7 +285,12 @@ def test_get_features(config, api_): rsp_headers, code, response = api_.get_features( req_headers, {'datetime': '2002/2014-04-22'}, 'obs') - assert code == 400 + api_.config['datasets']['obs']['extents'].pop('temporal') + + rsp_headers, code, response = api_.get_features( + req_headers, {'datetime': '2002/2014-04-22'}, 'obs') + + assert code == 200 def test_get_feature(config, api_):