def testrun_has_summary_counts(step, stored_testrun, testrun_name):
    trModel = TestrunModel()

    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    # get the list of testcases for this testrun
    summary_list = trModel.get_summary_list(testrun)

    # walk through and verify that each testcase has the expected status
    for category in step.hashes:
        # find that in the list of testcases
        status_id = get_result_status_id(category["name"])
        categoryInfo = verify_single_item_in_list(summary_list, "categoryName",
                                                  status_id)
        assert str(categoryInfo[ns("categoryValue")]) == category["count"], \
            "%s count was wrong.  Expected categoryName: %s , categoryValue: %s:\n%s" % \
            (category["name"], status_id, category["count"], jstr(categoryInfo))
def testrun_has_summary_counts(step, stored_testrun, testrun_name):
    trModel = TestrunModel()

    testrun = trModel.get_stored_or_store_obj(stored_testrun, testrun_name)

    # get the list of testcases for this testrun
    summary_list = trModel.get_summary_list(testrun)

    # walk through and verify that each testcase has the expected status
    for category in step.hashes:
        # find that in the list of testcases
        status_id = get_result_status_id(category["name"])
        categoryInfo = verify_single_item_in_list(summary_list, "categoryName",
                                                  status_id)
        assert str(categoryInfo[ns("categoryValue")]) == category["count"], \
            "%s count was wrong.  Expected categoryName: %s , categoryValue: %s:\n%s" % \
            (category["name"], status_id, category["count"], jstr(categoryInfo))
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")