From 642badb08df8c14f7ce05d1d1440e3797b9b527e Mon Sep 17 00:00:00 2001 From: Jess MacQueen Date: Thu, 17 Jan 2019 17:31:23 -0800 Subject: [PATCH] feat(api): Get rid of minimum time window for event endpoints --- src/sentry/api/utils.py | 8 ++++---- tests/sentry/api/test_utils.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sentry/api/utils.py b/src/sentry/api/utils.py index b6bef3bbde95db..5b03961d6e5340 100644 --- a/src/sentry/api/utils.py +++ b/src/sentry/api/utils.py @@ -7,10 +7,10 @@ from sentry.search.utils import parse_datetime_string, InvalidQuery from sentry.utils.dates import parse_stats_period -MIN_STATS_PERIOD = timedelta(hours=1) + MAX_STATS_PERIOD = timedelta(days=90) -# make sure to update this message if you are changing the min/max period -INVALID_PERIOD_ERROR = 'Time window must be greater than an hour and less than or equal to 90 days' +# make sure to update this message if you are changing the max period +INVALID_PERIOD_ERROR = 'Time window must be less than or equal to 90 days' class InvalidParams(Exception): @@ -81,7 +81,7 @@ def get_date_range_from_params(params, optional=False, validate_window=True): if validate_window: delta = end - start - if delta < MIN_STATS_PERIOD or delta > MAX_STATS_PERIOD: + if delta > MAX_STATS_PERIOD: raise InvalidParams(INVALID_PERIOD_ERROR) return start, end diff --git a/tests/sentry/api/test_utils.py b/tests/sentry/api/test_utils.py index 97e13116804082..39611a99977306 100644 --- a/tests/sentry/api/test_utils.py +++ b/tests/sentry/api/test_utils.py @@ -28,7 +28,7 @@ def test_stats_period(self): assert end - datetime.timedelta(seconds=3600) == start with self.assertRaises(InvalidParams): - get_date_range_from_params({'statsPeriod': '1s'}) + get_date_range_from_params({'statsPeriod': '91d'}) def test_date_range(self): start, end = get_date_range_from_params({