Exemple #1
0
    def search_and_verify(self,
                          uri,
                          search_args,
                          expect_to_find,
                          tcm_type=None):
        '''
            This does a search based on the search_args passed in.  So "expect_to_find"
            is really filtered based on those parameters.

            expect_to_find: If True, then we verify based on expecting to find something.
                            If False, this will fail if we get a resultset greater than 0.
        '''
        if tcm_type == None:
            tcm_type = self.singular

        resp_list = self.get_list_from_search(uri, params=search_args)

        if not expect_to_find:
            eq_(len(resp_list), 0,
                "expect result size zero:\n" + jstr(resp_list))
        else:
            # we want to verify just ONE of the items returned.  Indeed, we likely
            # expect only one.  So we pick the first item returned

            verify_single_item_in_list(resp_list, params=search_args)
def verify_status(exp_status, response, msg):
    '''
        Helper that prints out the error message if something other than what's expected
        is returned.
    '''
    data = response.read()
    eq_(response.status, exp_status, "URI: %s/n%s" % (msg, str(data)))
    return data
def verify_status(exp_status, response, msg):
    '''
        Helper that prints out the error message if something other than what's expected
        is returned.
    '''
    data = response.read()
    eq_(response.status, exp_status, "URI: %s/n%s" % (msg, str(data)))
    return data
def check_group_environmenttype_with_name(step, stored, name, is_group):
    envtypeModel = EnvironmenttypeModel()

    name = envtypeModel.get_stored_or_store_name(stored, name)
    groupType = (is_group.strip() == "a group")

    env_type = envtypeModel.get_by_name(name)

    eq_(env_type[ns("groupType")], groupType, "GroupType match check")
Exemple #5
0
def logged_in_as_user(step, stored, name):
    userModel = UserModel()
    name = userModel.get_stored_or_store_name(stored, name)
    names = name.split()

    thisUser = userModel.get_logged_in_user()

    eq_(thisUser[ns("firstName")], names[0], "First Name field didn't match")
    eq_(thisUser[ns("lastName")], names[1], "Last Name field didn't match")
def testcycle_has_percent_complete_of_X(step, stored_testcycle, testcycle_name, exp_percent):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle, testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    act_percent = testcycleModel.get_percent_complete(testcycle_id)

    eq_(act_percent[ns("categoryValue")], int(exp_percent), "percent complete check")
def logged_in_as_user(step, stored, name):
    userModel = UserModel()
    name = userModel.get_stored_or_store_name(stored, name)
    names = name.split()

    thisUser = userModel.get_logged_in_user()

    eq_(thisUser[ns("firstName")], names[0], "First Name field didn't match")
    eq_(thisUser[ns("lastName")], names[1], "Last Name field didn't match")
def testcases_have_approval_statuses(step):

    tcModel = TestcaseModel()

    for tc in step.hashes:
        testcase_id = tcModel.get_resid(tc["name"])[0]
        testcaseversion = tcModel.get_latestversion(testcase_id)
        # should be just one
        try:
            eq_(testcaseversion[ns("approvalStatusId")], 2, "Testcase is approved: " + str(testcaseversion))
        except KeyError:
            assert False, "Object field mismatch.\nExpected:\n" + ns("approved") + "\n\nActual:\n" + jstr(testcaseversion)
def testcase_has_status_of_approved(step, stored, testcase_name):
    tcModel = TestcaseModel()
    testcase_name = tcModel.get_stored_or_store_name(stored, testcase_name)

    # fetch the steps for this testcase from the latestversion
    testcase_id = tcModel.get_resid(testcase_name)[0]
    testcaseversion = tcModel.get_latestversion(testcase_id)
    # should be just one
    try:
        eq_(testcaseversion[ns("approvalStatusId")], 2, "Testcase is approved: " + str(testcaseversion))
    except KeyError:
        assert False, "Object field mismatch.\nExpected:\n" + ns("approved") + "\n\nActual:\n" + jstr(testcaseversion)
Exemple #10
0
def testcycle_has_percent_complete_of_X(step, stored_testcycle, testcycle_name,
                                        exp_percent):
    testcycleModel = TestcycleModel()
    testcycle = testcycleModel.get_stored_or_store_obj(stored_testcycle,
                                                       testcycle_name)
    testcycle_id = get_resource_identity(testcycle)[0]

    # get the list of testcases for this testcycle
    act_percent = testcycleModel.get_percent_complete(testcycle_id)

    eq_(act_percent[ns("categoryValue")], int(exp_percent),
        "percent complete check")
def testrun_results_have_approval_statuses(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testcaseModel = TestcaseModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    for testcase in step.hashes:
        testcase_id = testcaseModel.get_resid(testcase["name"])[0]

        result_obj = testrunModel.get_result(testcase_id, testrun_id)
        eq_(result_obj[ns("approvalStatusId")],
            get_approval_status_id(testcase["status"]),
            "Wrong approvalStatusId for result.  Expected:\n%s" % testcase)
def testcase_has_status_of_approved(step, stored, testcase_name):
    tcModel = TestcaseModel()
    testcase_name = tcModel.get_stored_or_store_name(stored, testcase_name)

    # fetch the steps for this testcase from the latestversion
    testcase_id = tcModel.get_resid(testcase_name)[0]
    testcaseversion = tcModel.get_latestversion(testcase_id)
    # should be just one
    try:
        eq_(testcaseversion[ns("approvalStatusId")], 2,
            "Testcase is approved: " + str(testcaseversion))
    except KeyError:
        assert False, "Object field mismatch.\nExpected:\n" + ns(
            "approved") + "\n\nActual:\n" + jstr(testcaseversion)
def testcases_have_approval_statuses(step):

    tcModel = TestcaseModel()

    for tc in step.hashes:
        testcase_id = tcModel.get_resid(tc["name"])[0]
        testcaseversion = tcModel.get_latestversion(testcase_id)
        # should be just one
        try:
            eq_(testcaseversion[ns("approvalStatusId")], 2,
                "Testcase is approved: " + str(testcaseversion))
        except KeyError:
            assert False, "Object field mismatch.\nExpected:\n" + ns(
                "approved") + "\n\nActual:\n" + jstr(testcaseversion)
def testrun_results_have_approval_statuses(step, stored_testrun, testrun_name):
    testrunModel = TestrunModel()
    testcaseModel = TestcaseModel()
    testrun = testrunModel.get_stored_or_store_obj(stored_testrun,
                                                   testrun_name)
    testrun_id = get_resource_identity(testrun)[0]

    for testcase in step.hashes:
        testcase_id = testcaseModel.get_resid(testcase["name"])[0]

        result_obj = testrunModel.get_result(testcase_id, testrun_id)
        eq_(result_obj[ns("approvalStatusId")],
            get_approval_status_id(testcase["status"]),
            "Wrong approvalStatusId for result.  Expected:\n%s" % testcase)
def verify_testcase_steps(step, stored, name):
    tcModel = TestcaseModel()
    name = tcModel.get_stored_or_store_name(stored, name)

    testcasestep_list = tcModel.get_latest_steps_list(name)

    # compare the returned values with those passed in to verify match
    step_num = 0
    try:
        for exp_step in step.hashes:
            act_step = testcasestep_list[step_num]
            eq_(act_step[ns("name")], exp_step["name"], "name match")
            step_num += 1
    except KeyError:
        assert False, "Object field mismatch.\nExpected:\n" + jstr(step.hashes) + "\n\nActual:\n" + jstr(testcasestep_list)
def verify_testcase_steps(step, stored, name):
    tcModel = TestcaseModel()
    name = tcModel.get_stored_or_store_name(stored, name)

    testcasestep_list = tcModel.get_latest_steps_list(name)

    # compare the returned values with those passed in to verify match
    step_num = 0
    try:
        for exp_step in step.hashes:
            act_step = testcasestep_list[step_num]
            eq_(act_step[ns("name")], exp_step["name"], "name match")
            step_num += 1
    except KeyError:
        assert False, "Object field mismatch.\nExpected:\n" + jstr(
            step.hashes) + "\n\nActual:\n" + jstr(testcasestep_list)
def testcases_have_result_statuses(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = trModel.get_result(
            testcase_id, includedtestcase_list=includedtestcase_list)

        # ok, we have the tc result in question, now check that its status matches expectations
        eq_(result[ns("testRunResultStatusId")],
            get_result_status_id(tc["status"]), "testRunResultStatusId check")
def testcases_have_result_statuses(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = trModel.get_result(testcase_id,
                                    includedtestcase_list = includedtestcase_list)

        # ok, we have the tc result in question, now check that its status matches expectations
        eq_(result[ns("testRunResultStatusId")],
            get_result_status_id(tc["status"]),
            "testRunResultStatusId check")
def testcases_have_pending_result_statuses(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]
    status_id = get_result_status_id("Pending")
    # get the list of testcases for this testrun
    result_list = trModel.search_for_results_by_result_status(
        testrun_id, status_id)

    eq_list_length(result_list, step.hashes)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = verify_single_item_in_list(result_list, "testCaseId",
                                            testcase_id)

        # ok, we have the tc result in question, now check that its status matches expectations
        eq_(result[ns("testRunResultStatusId")], status_id,
            "testRunResultStatusId check")
def testcases_have_pending_result_statuses(step, stored_testrun, testrun_name):
    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    testrun_id = get_resource_identity(testrun)[0]
    status_id = get_result_status_id("Pending")
    # get the list of testcases for this testrun
    result_list = trModel.search_for_results_by_result_status(testrun_id,
                                                              status_id)

    eq_list_length(result_list, step.hashes)

    for tc in step.hashes:
        testcase_id = TestcaseModel().get_resid(tc["name"])[0]

        result = verify_single_item_in_list(result_list, "testCaseId", testcase_id)

        # ok, we have the tc result in question, now check that its status matches expectations
        eq_(result[ns("testRunResultStatusId")],
            status_id,
            "testRunResultStatusId check")
Exemple #21
0
    def search_and_verify(self, uri, search_args, expect_to_find, tcm_type = None):
        '''
            This does a search based on the search_args passed in.  So "expect_to_find"
            is really filtered based on those parameters.

            expect_to_find: If True, then we verify based on expecting to find something.
                            If False, this will fail if we get a resultset greater than 0.
        '''
        if tcm_type == None:
            tcm_type = self.singular

        resp_list = self.get_list_from_search(uri, params = search_args)

        if not expect_to_find:
            eq_(len(resp_list), 0, "expect result size zero:\n" + jstr(resp_list))
        else:
            # we want to verify just ONE of the items returned.  Indeed, we likely
            # expect only one.  So we pick the first item returned

            verify_single_item_in_list(resp_list,
                                       params = search_args)
def check_url_for_the_testcase_result_has_not_changed(step, stored_testcase, testcase_name, stored_testrun, testrun_name):
    stored_url = get_stored_or_store_field("url", "testcaseRunResult", "that url", None)


    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    tcModel = TestcaseModel()
    testcase = tcModel.get_stored_or_store_obj(stored_testcase, testcase_name)

    testrun_id = get_resource_identity(testrun)[0]
    testcase_id = get_resource_identity(testcase)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    result = trModel.get_result(testcase_id,
                                includedtestcase_list = includedtestcase_list)
    testresult_url = result[ns("resourceIdentity")]["@url"]

    eq_(testresult_url,
            stored_url,
            "testRunResult URL check")
def check_url_for_the_testcase_result_has_not_changed(step, stored_testcase,
                                                      testcase_name,
                                                      stored_testrun,
                                                      testrun_name):
    stored_url = get_stored_or_store_field("url", "testcaseRunResult",
                                           "that url", None)

    trModel = TestrunModel()
    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)
    tcModel = TestcaseModel()
    testcase = tcModel.get_stored_or_store_obj(stored_testcase, testcase_name)

    testrun_id = get_resource_identity(testrun)[0]
    testcase_id = get_resource_identity(testcase)[0]

    # get the list of testcases for this testrun
    includedtestcase_list = trModel.get_included_testcases(testrun_id)

    result = trModel.get_result(testcase_id,
                                includedtestcase_list=includedtestcase_list)
    testresult_url = result[ns("resourceIdentity")]["@url"]

    eq_(testresult_url, stored_url, "testRunResult URL check")