def test_009_update(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) plan.color = "red" plan.update() plan.color = "" plan.reload() self.assertEquals(plan.color, "red")
def create_requirements(bz_rfes, bz_connection): idx = 0 plan = Plan(project_id=POLARION_PRODUCT, plan_id=POLARION_VERSION) req_ids = list() # bz_rfe = bz_rfes[0] #for x in range(103,127): for bz_rfe in bz_rfes: #bz_rfe = bz_rfes[x] bug_title, named_parms, bug_description, bug_link, bug_id, bug_priority, bug_severity, bug_dfg = get_bug_params( bz_rfe) print "\n%s - start bug %s" % (datetime.datetime.now(), idx), idx += 1 print '"{}"'.format(bug_link) if isRequirementInPolarion(bug_link) == False: #TODO Convert bugzilla to Polarion priority and set #named_parms["priority"] = convert_polarion_priority(bug_priority) # Convert bugzilla to Polarion severity and set named_parms["severity"] = convert_polarion_severity(bug_severity) # Set Polarion requirement type named_parms["reqtype"] = "functional" #Cenvert DFG name from bugzilla to dfg_id in Polarion named_parms["d_f_g"] = convert_polarion_dfg(bug_dfg) #Get bug description from first comment and add to Polarion requirement desc = "" if bug_description: desc = Text( bug_description.encode('ascii', 'ignore').decode('ascii')) # decode("utf-8")) desc.content_type = "text/plain" # Add hyperlink to bugzilla link = Hyperlink() link.role = "ref_ext" link.uri = bug_link req = Requirement.create(project_id=POLARION_PRODUCT, title=bug_title, desc=desc, **named_parms) req.add_hyperlink(link.uri, link.role) req.status = "approved" req.update() #Get requirement ID and update bugzilla extrenal link tracker bz_connection.add_external_tracker( str(bz_rfe.id), str(req.work_item_id), ext_type_description="Polarion Requirement") req_ids.append(req.work_item_id) print "%s - end bug: %s" % (datetime.datetime.now(), bug_link) plan.add_plan_items(req_ids)
def test_010_delete(self): Plan.delete_plans(DEFAULT_PROJ, PLAN_ID) with self.assertRaises(PylarionLibException): Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID)
def test_008_remove_wi(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) plan.remove_plan_items([self.NEW_REQ]) plan.reload() self.assertEquals(len(plan.records), 1) self.assertEquals(plan.records[0].item, self.NEW_REQ2)
def test_007_stats(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) stats = plan.get_statistics() self.assertEquals(stats.number_of_planned, 2)
def test_006_add_items(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) plan.add_plan_items([self.NEW_REQ, self.NEW_REQ2]) plan.reload() self.assertEquals(len(plan.records), 2)
def test_005_get_plan(self): plan = Plan(project_id=DEFAULT_PROJ, plan_id=PLAN_ID) self.assertEquals(plan.plan_id, PLAN_ID) plan2 = Plan(uri=plan.uri) self.assertEquals(plan2.plan_id, PLAN_ID)