summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/resources
diff options
context:
space:
mode:
authorSerena Feng <feng.xiaowei@zte.com.cn>2017-07-19 09:47:59 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-19 09:47:59 +0000
commitb1b4c2dd8a5532c65b5df46f14721a5a421682d3 (patch)
treea215134b7652e651d2c3171a68e49b4b6ffab0c5 /utils/test/testapi/opnfv_testapi/resources
parent7d01201372a7a04e8a0d109ebd25adea614914f6 (diff)
parentdb986d8524d8befa075b213c81168f7102c78b56 (diff)
Merge "bugfix: query doesn't work well with period=1"
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/resources')
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/result_handlers.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
index 2e15e7a4d..f9706fc97 100644
--- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
@@ -60,6 +60,12 @@ class GenericResultHandler(handlers.GenericApiHandler):
query[k] = v
if date_range:
query['start_date'] = date_range
+
+ # if $lt is not provided,
+ # empty/None/null/'' start_date will also be returned
+ if 'start_date' in query and '$lt' not in query['start_date']:
+ query['start_date'].update({'$lt': str(datetime.now())})
+
return query