[yocto] [qa-tools][PATCH 2/4] poduct/init: Add functions to get product and environment names

jose.perez.carranza at linux.intel.com jose.perez.carranza at linux.intel.com
Tue Jun 13 08:47:26 PDT 2017


From: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>

Add functions as follows:
- get_test_plan_by_id : Get test plan providing the plan ID
- get_product_name: Get product name providing the product ID
- get_environment_by_id: Get environment providing the environment ID

Signed-off-by: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
---
 testopia_update/product/__init__.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/testopia_update/product/__init__.py b/testopia_update/product/__init__.py
index a24196a..8d31a1e 100644
--- a/testopia_update/product/__init__.py
+++ b/testopia_update/product/__init__.py
@@ -32,6 +32,17 @@ class Product(object):
 
         return tp
 
+    def get_test_plan_by_id(self, plan_id):
+        tp = self.testopia.testplan_get(plan_id)
+
+        return tp
+
+    def get_product_name(self, product_id):
+        prod_name = self.testopia.product_lookup_name_by_id(product_id)
+
+        return prod_name
+
+
     def get_environment(self, tp, env_name):
         tp_envs = self.testopia.product_get_environments(tp['product_id'])
         for tp_env in tp_envs:
@@ -47,6 +58,12 @@ class Product(object):
         tp_envs = self.testopia.product_get_environments(tp['product_id'])
         return [tp_env['name'] for tp_env in tp_envs]
 
+    def get_environment_by_id(self, env_id):
+        environment_id = self.testopia.testrun_lookup_environment_name_by_id(env_id)
+
+        return environment_id
+
+
     def _format_build_name(self, project_version, project_revision):
         return "%s: %s" % (project_version, project_revision)
 
-- 
2.11.0




More information about the yocto mailing list