From: Jose Perez Carranza <jose.perez.carra...@linux.intel.com> Add “clone_template” function that allow cloning in the same branch or for X to Y branch, also add “get_test_run_list” to do a query of test runs with specific summary and specific test plan.
Signed-off-by: Jose Perez Carranza <jose.perez.carra...@linux.intel.com> --- testopia_update/product/__init__.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/testopia_update/product/__init__.py b/testopia_update/product/__init__.py index f31190c..ba34d02 100644 --- a/testopia_update/product/__init__.py +++ b/testopia_update/product/__init__.py @@ -150,6 +150,26 @@ class Product(object): return new_test_run + def clone_template(self, test_run, old_project_version, new_project_version, + **kwargs): + if 'new_branch' in kwargs: + plan_id = self.get_test_plan(kwargs['new_branch'])['plan_id'] + else: + plan_id = test_run['plan_id'] + + test_case_ids = self._get_test_case_ids(test_run) + summary = test_run['summary'].replace(old_project_version, + new_project_version) + + summary = summary.replace('TEMPLATE','TRTEMP') + + new_test_run = self.testopia.testrun_create(test_run['build_id'], + test_run['environment_id'], plan_id, summary, + self.testopia.userId, product_version=new_project_version) + self.testopia.testrun_add_cases(test_case_ids, new_test_run['run_id']) + + return new_test_run + def parse_results_log(self, log_file): regex = "^.*RESULTS.* (?P<case_id>\d+): (?P<status>PASSED|FAILED)$" if hasattr(self, 'results_regex'): @@ -195,6 +215,12 @@ class Product(object): return tr_id + def get_test_run_list(self, test_plan, temp_summary): + list_test_runs = self.testopia.testrun_list(plan_id=test_plan['plan_id'], + summary=temp_summary) + + return list_test_runs + class DummyProduct(Product): #Dummy product to use when specific product is not required name = 'Dummy' -- 2.11.0 -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto