def create_testplan(project_id, release_testplan, build_testplan): """ Creates release test plan and build test plan """ from pylero.plan import Plan release_testplan_id = release_testplan.replace(".", "_") build_testplan_id = build_testplan.replace(".", "_") rst_res = Plan.search("id:{}".format(release_testplan_id)) if rst_res == []: Plan.create(release_testplan_id, release_testplan, project_id, None, "release") else: print("release test plan {} already exists".format(release_testplan)) plan = Plan(project_id=project_id, plan_id=release_testplan_id) if plan.status == "open": plan.status = "inprogress" plan.update() btp_res = Plan.search("id:{}".format(build_testplan_id)) if btp_res == []: res = Plan.create(build_testplan_id, build_testplan, project_id, release_testplan_id, "iteration") else: res = True print("build test plan {} already exists".format(build_testplan)) plan = Plan(project_id=project_id, plan_id=build_testplan_id) if plan.status == "open": plan.status = "inprogress" plan.update() return res
def print_plan_ids(self, query): pls = Plan.search(query, sort='due_date', limit=-1, fields=['due_date', 'name', 'plan_id']) ttstr = ('Due Date%-5sPlan ID%-24sPlan Name' % ('', '')) lnstr = ('----------- ---------- %-20s---------' % '') print(ttstr) print(lnstr) for pl in pls: print('%-12s %-30s %s' % (pl.due_date, pl.plan_id, pl.name))
def test_004_search_plan(self): lst_res = Plan.search("id:%s" % PLAN_ID) self.assertEquals(len(lst_res), 1) self.assertEquals(lst_res[0].plan_id, PLAN_ID)
def test_003_search_template(self): lst_res = Plan.search("id:%s" % TEMPLATE_ID, search_templates=True) self.assertEquals(len(lst_res), 1) self.assertEquals(lst_res[0].plan_id, TEMPLATE_ID)