diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-07-27 12:38:13 +0800 |
---|---|---|
committer | Jose Lausuch <jose.lausuch@ericsson.com> | 2016-07-27 09:28:05 +0000 |
commit | ebd48fb22672ba26b05ee638a4aac7cd0b456f8d (patch) | |
tree | 41201e2fa1afc9075c2b707ea5402e9a0e17bae7 /utils/test | |
parent | 31bff7be93ba291b9f61867f74baf663fc72c751 (diff) |
update testapi server in testresults.opnfv.org
support body of post results carries no trust_indicator
add unittest of no trust_indicator in post results body
specify changes in db
JIRA: FUNCTEST-391
Change-Id: Ic61a5edbad1bca7689d618761bca94ef69dea80b
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test')
3 files changed, 47 insertions, 27 deletions
diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/result_models.py b/utils/test/result_collection_api/opnfv_testapi/resources/result_models.py index dd1e3dc53..f73f5c612 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/result_models.py +++ b/utils/test/result_collection_api/opnfv_testapi/resources/result_models.py @@ -55,15 +55,14 @@ class TI(object): @staticmethod def from_dict(a_dict): - if a_dict is None: - return None t = TI() - t.current = a_dict.get('current') - if 'histories' in a_dict.keys(): - for history in a_dict.get('histories', None): - t.histories.append(TIHistory.from_dict(history)) - else: - t.histories = [] + if a_dict: + t.current = a_dict.get('current') + if 'histories' in a_dict.keys(): + for history in a_dict.get('histories', None): + t.histories.append(TIHistory.from_dict(history)) + else: + t.histories = [] return t @@ -97,7 +96,7 @@ class ResultCreateRequest(object): self.build_tag = build_tag self.scenario = scenario self.criteria = criteria - self.trust_indicator = trust_indicator + self.trust_indicator = trust_indicator if trust_indicator else TI(0) def format(self): return { diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_result.py b/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_result.py index 98ef7c08c..eee06c6e5 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_result.py +++ b/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_result.py @@ -182,6 +182,24 @@ class TestResultCreate(TestResultBase): self.assertEqual(code, HTTP_OK) self.assert_href(body) + def test_no_ti(self): + req = ResultCreateRequest(pod_name=self.pod, + project_name=self.project, + case_name=self.case, + installer=self.installer, + version=self.version, + start_date=self.start_date, + stop_date=self.stop_date, + details=self.details.format(), + build_tag=self.build_tag, + scenario=self.scenario, + criteria=self.criteria) + (code, res) = self.create(req) + _id = res.href.split('/')[-1] + self.assertEqual(code, HTTP_OK) + code, body = self.get(_id) + self.assert_res(code, body, req) + class TestResultGet(TestResultBase): def test_getOne(self): diff --git a/utils/test/result_collection_api/update/templates/changes_in_mongodb.py b/utils/test/result_collection_api/update/templates/changes_in_mongodb.py index b3e23803d..9744dd9fe 100644 --- a/utils/test/result_collection_api/update/templates/changes_in_mongodb.py +++ b/utils/test/result_collection_api/update/templates/changes_in_mongodb.py @@ -24,24 +24,27 @@ docs_old2New = { # ({'criteria': 'failed'}, {'criteria': 'FAILED'}), # ({'criteria': 'passed'}, {'criteria': 'PASS'}) # ] - 'testcases': [ - ({'name': 'vPing'}, {'name': 'vping_ssh'}), - ({'name': 'Tempest'}, {'name': 'tempest_smoke_serial'}), - ({'name': 'Rally'}, {'name': 'rally_sanity'}), - ({'name': 'ODL'}, {'name': 'odl'}), - ({'name': 'vIMS'}, {'name': 'vims'}), - ({'name': 'ONOS'}, {'name': 'onos'}), - ({'name': 'vPing_userdata'}, {'name': 'vping_userdata'}), - ({'name': 'ovno'}, {'name': 'ocl'}) - ], + # 'testcases': [ + # ({'name': 'vPing'}, {'name': 'vping_ssh'}), + # ({'name': 'Tempest'}, {'name': 'tempest_smoke_serial'}), + # ({'name': 'Rally'}, {'name': 'rally_sanity'}), + # ({'name': 'ODL'}, {'name': 'odl'}), + # ({'name': 'vIMS'}, {'name': 'vims'}), + # ({'name': 'ONOS'}, {'name': 'onos'}), + # ({'name': 'vPing_userdata'}, {'name': 'vping_userdata'}), + # ({'name': 'ovno'}, {'name': 'ocl'}) + # ], + # 'results': [ + # ({'case_name': 'vPing'}, {'case_name': 'vping_ssh'}), + # ({'case_name': 'Tempest'}, {'case_name': 'tempest_smoke_serial'}), + # ({'case_name': 'Rally'}, {'case_name': 'rally_sanity'}), + # ({'case_name': 'ODL'}, {'case_name': 'odl'}), + # ({'case_name': 'vIMS'}, {'case_name': 'vims'}), + # ({'case_name': 'ONOS'}, {'case_name': 'onos'}), + # ({'case_name': 'vPing_userdata'}, {'case_name': 'vping_userdata'}), + # ({'case_name': 'ovno'}, {'case_name': 'ocl'}) + # ] 'results': [ - ({'case_name': 'vPing'}, {'case_name': 'vping_ssh'}), - ({'case_name': 'Tempest'}, {'case_name': 'tempest_smoke_serial'}), - ({'case_name': 'Rally'}, {'case_name': 'rally_sanity'}), - ({'case_name': 'ODL'}, {'case_name': 'odl'}), - ({'case_name': 'vIMS'}, {'case_name': 'vims'}), - ({'case_name': 'ONOS'}, {'case_name': 'onos'}), - ({'case_name': 'vPing_userdata'}, {'case_name': 'vping_userdata'}), - ({'case_name': 'ovno'}, {'case_name': 'ocl'}) + ({'trust_indicator': 0}, {'trust_indicator': {'current': 0, 'histories': []}}) ] } |