Ejemplo n.º 1
0
def mark_for_deletion(tc, tag):
    if tag in tc.title:
        wi = TestCase(uri=tc.uri)
        wi.title = "stoner-DeleteMe"
        try:
            wi.update()
            print "Changed {} title from {} to {}".format(wi.work_item_id, tc.title, wi.title)
        except:
            print "Failed to change {}".format(wi.work_item_id)
Ejemplo n.º 2
0
 def test_013_multiple_types(self):
     req = Requirement()
     tc = TestCase()
     with self.assertRaises(AttributeError):
         tc.reqtype
     with self.assertRaises(AttributeError):
         req.caseimportance
     req.title = "req1"
     tc.title = "tc1"
     self.assertNotEqual(req.title, tc.title)
Ejemplo n.º 3
0
def add_colon_tc(tc):
    parts = tc.title.split()
    if ":" not in tc.title:
        newtitle = parts[0] + " : " + parts[1]
        wi = TestCase(uri=tc.uri)
        wi.title = newtitle
        try:
            wi.update()
            print "Changed title to {}".format(newtitle)
        except:
            print "Failed to update {}".format(wi.title)
 def test_bad_character(self):
     """this test validates that non UTF-8 characters will cause an error
     """
     test_case = TestCase()
     steps = TestSteps()
     with self.assertRaises(PylarionLibException):  # check _obj_setter
         test_case.status = u"é".encode('latin')
     with self.assertRaises(PylarionLibException):  # check _custom_setter
         test_case.tcmscaseid = u"é".encode('latin')
     with self.assertRaises(PylarionLibException):  # check _regular_setter
         test_case.title = u"é".encode('latin')
     with self.assertRaises(PylarionLibException):  # check _arr_obj_setter
         steps.keys = [u"é".encode('latin')]
 def test_006_create_work_item(self):
     tc = TestCase()
     tc.title = "regression"
     tc.description = "regression document test"
     tc.status = "draft"
     tc.caseimportance = "high"
     tc.caselevel = "component"
     tc.caseautomation = "notautomated"
     tc.caseposneg = "positive"
     tc.testtype = "functional"
     tc.subtype1 = "-"
     doc = Document(uri=self.doc_create.uri)
     wi = doc.create_work_item(None, tc)
     doc_wis = doc.get_work_items(None, True)
     doc_wi_ids = [doc_wi.work_item_id for doc_wi in doc_wis]
     self.assertIn(wi.work_item_id, doc_wi_ids)
     global WI_ID
     WI_ID = wi.work_item_id
Ejemplo n.º 6
0
def remove_linked_requirements_from_tests(test_cases):
    """
    Removes all linked Items from TestCase objects in test_Cases

    :param test_cases:
    :return:
    """
    with open("/tmp/tc_delete.txt", "w") as tcd:
        for tc in test_cases:
            tc = TestCase(uri=tc.uri)
            linked_items  = tc.linked_work_items
            for li in linked_items:
                tc.remove_linked_item(li.work_item_id, "verifies")
            tc.title = "DeleteMe"
            if tc.author == "ci-user":
                tc.author = "stoner"
            tcd.write(tc.work_item_id + "\n")
            tcd.flush()
            tc.update()
Ejemplo n.º 7
0
def fix_tc_title(tc):
    """
    Need to add RHSM-TC : prefix to the existing testcases

    :param tc:
    :return:
    """
    if tc.title.startswith("RHSM-TC : "):
        print "TestCase already starts with RHSM-TC : "
        return

    newtitle = "RHSM-TC : " + tc.title
    wi = TestCase(uri=tc.uri)
    wi.title = newtitle
    try:
        wi.update()
        print "Changed {} title to {}".format(wi.work_item_id, newtitle)
    except:
        print "Failed to update {}".format(wi.title)