summaryrefslogtreecommitdiffstats
path: root/result_collection_api/resources/handlers.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2015-11-12 17:36:27 +0100
committerMorgan Richomme <morgan.richomme@orange.com>2015-11-19 12:26:55 +0100
commit3c65aa2aca6598443e6062776edecbb6b2cdbc9b (patch)
tree98415674555d94b653c71b3bee2e1bb3fc757202 /result_collection_api/resources/handlers.py
parent63e93206195c467dfc009d097a670a7a0dc7524e (diff)
add vIMS for dahsboard
JIRA: FUNCTEST-64 Change-Id: I344c3a882d64acdcd310decf015f234964faeb5a Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'result_collection_api/resources/handlers.py')
-rw-r--r--result_collection_api/resources/handlers.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/result_collection_api/resources/handlers.py b/result_collection_api/resources/handlers.py
index 85c6172..be08c97 100644
--- a/result_collection_api/resources/handlers.py
+++ b/result_collection_api/resources/handlers.py
@@ -719,6 +719,21 @@ class DashboardHandler(GenericApiHandler):
"error:Project name missing")
elif check_dashboard_ready_project(project_arg, "./dashboard"):
res = []
+
+ if case_arg is None:
+ raise HTTPError(
+ HTTP_NOT_FOUND,
+ "error:Test case missing for project " + project_arg)
+
+ # special case of status for project
+ if case_arg == "status":
+ del get_request["case_name"]
+ # retention time to be agreed
+ # last five days by default?
+ # TODO move to DB
+ period = datetime.now() - timedelta(days=5)
+ get_request["creation_date"] = {"$gte": period}
+
# fetching results
cursor = self.db.test_results.find(get_request)
while (yield cursor.fetch_next):
@@ -726,11 +741,7 @@ class DashboardHandler(GenericApiHandler):
cursor.next_object())
res.append(test_result.format_http())
- if case_arg is None:
- raise HTTPError(
- HTTP_NOT_FOUND,
- "error:Test case missing for project " + project_arg)
- elif check_dashboard_ready_case(project_arg, case_arg):
+ if check_dashboard_ready_case(project_arg, case_arg):
dashboard = get_dashboard_result(project_arg, case_arg, res)
else:
raise HTTPError(