diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-05-31 14:42:08 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-05-31 14:42:08 +0000 |
commit | dd67e264f4b5c01b9b493d215377b15c1a953c4b (patch) | |
tree | bcb3ecaa14e1d10d3da908d48b621cbe33b14bf0 | |
parent | 9db273c8ee2782b7d9ceb55c7139871ce2513ea0 (diff) | |
parent | 94fbad49d3b35bd9c997e1904d265b7b25d81a0f (diff) |
Merge "bugfix: query results failed due to wrong using type of trust_indicator"
3 files changed, 13 insertions, 6 deletions
diff --git a/utils/test/result_collection_api/resources/result_handlers.py b/utils/test/result_collection_api/resources/result_handlers.py index e7fce47df..1d52235f6 100644 --- a/utils/test/result_collection_api/resources/result_handlers.py +++ b/utils/test/result_collection_api/resources/result_handlers.py @@ -32,6 +32,8 @@ class GenericResultHandler(GenericApiHandler): period = datetime.now() - timedelta(days=v) obj = {"$gte": str(period)} query['creation_date'] = obj + elif k == 'trust_indicator': + query[k] = float(v) else: query[k] = v return query @@ -98,7 +100,7 @@ class ResultsCLHandler(GenericResultHandler): @type period: L{string} @in period: query @required period: False - @param trust_indicator: must be integer + @param trust_indicator: must be int/long/float @type trust_indicator: L{string} @in trust_indicator: query @required trust_indicator: False diff --git a/utils/test/result_collection_api/resources/result_models.py b/utils/test/result_collection_api/resources/result_models.py index 27c354220..40d21c331 100644 --- a/utils/test/result_collection_api/resources/result_models.py +++ b/utils/test/result_collection_api/resources/result_models.py @@ -48,6 +48,10 @@ class ResultCreateRequest(object): @swagger.model() class TestResult(object): + """ + @property trust_indicator: must be int/long/float + @ptype trust_indicator: L{float} + """ def __init__(self, _id=None, case_name=None, project_name=None, pod_name=None, installer=None, version=None, start_date=None, stop_date=None, details=None, diff --git a/utils/test/result_collection_api/tests/unit/test_result.py b/utils/test/result_collection_api/tests/unit/test_result.py index 7829d7c6a..7b1f97654 100644 --- a/utils/test/result_collection_api/tests/unit/test_result.py +++ b/utils/test/result_collection_api/tests/unit/test_result.py @@ -79,9 +79,10 @@ class TestResultBase(TestBase): self.req_testcase, self.project) - def assert_res(self, code, result): + def assert_res(self, code, result, req=None): self.assertEqual(code, HTTP_OK) - req = self.req_d + if req is None: + req = self.req_d self.assertEqual(result.pod_name, req.pod_name) self.assertEqual(result.project_name, req.project_name) self.assertEqual(result.case_name, req.case_name) @@ -96,8 +97,8 @@ class TestResultBase(TestBase): self.assertEqual(result.scenario, req.scenario) self.assertEqual(result.criteria, req.criteria) self.assertEqual(result.trust_indicator, req.trust_indicator) - self.assertIsNotNone(result.start_date) - self.assertIsNotNone(result.stop_date) + self.assertEqual(result.start_date, req.start_date) + self.assertEqual(result.stop_date, req.stop_date) self.assertIsNotNone(result._id) @@ -233,8 +234,8 @@ class TestResultGet(TestResultBase): self.assertEqual(code, HTTP_OK) self.assertEqual(0, len(body.results)) else: + self.assertEqual(1, len(body.results)) for result in body.results: - self.assertEqual(1, len(body.results)) self.assert_res(code, result) def _set_query(self, *args): |