Exemple #1
0
def test_method_trend(request, method_id):
    if not request.user.is_staff:
        return redirect('/login/?next=%s' % request.path)

    method = get_object_or_404(TestMethod, id=method_id)

    latest_results = method.test_results.order_by('-build_flow__time_end')
    latest_results = paginate(latest_results, request)

    results_by_plan = {}
    i = 0
    for result in latest_results:
        plan_name = (
            result.build_flow.build.plan.name,
            result.build_flow.build.branch.name,
        )
        if plan_name not in results_by_plan:
            # Create the list padded with None for prior columns
            results_by_plan[plan_name] = [
                None,
            ] * i
        results_by_plan[plan_name].append(result)
        i += 1

        # Pad the other field's lists with None values for this column
        for key in results_by_plan.keys():
            if key == plan_name:
                continue
            else:
                results_by_plan[key].append(None)

    results = []
    plan_keys = results_by_plan.keys()
    plan_keys.sort()
    for key in plan_keys:
        plan_results = []
        for result in results_by_plan[key]:
            plan_results.append(result)
        results.append((key[0], key[1], plan_results))

    headers = ['Plan', 'Branch/Tag']
    headers += [
        '',
    ] * i

    data = {
        'method': method,
        'headers': headers,
        'results': results,
        'all_results': latest_results,
    }

    return render(request, 'testresults/test_method_trend.html', data)
Exemple #2
0
def test_method_peek(request, method_id):
    method = get_object_or_404(TestMethod, id=method_id)
    latest_fails = method.test_results.filter(
        outcome='Fail').order_by('-build_flow__time_end').select_related(
            'build_flow', 'build_flow__build', 'build_flow__build__repo',
            'build_flow__build__plan', 'build_flow__build__branch',
            'build_flow__build__branch__repo')
    latest_fails = paginate(latest_fails, request)

    data = {'method': method, 'latest_fails': latest_fails}

    return render(request, 'testresults/test_method_peek.html', data)
Exemple #3
0
def test_method_trend(request, method_id):
    build_qs = Build.objects.for_user(request.user)
    method = get_object_or_404(TestMethod, id=method_id)

    latest_results = method.test_results.filter(
        build_flow__build__in=build_qs
    ).order_by("-build_flow__time_end")
    latest_results = paginate(latest_results, request)

    results_by_plan = {}
    i = 0
    for result in latest_results:
        plan_name = (
            result.build_flow.build.plan.name,
            result.build_flow.build.branch.name,
        )
        if plan_name not in results_by_plan:
            # Create the list padded with None for prior columns
            results_by_plan[plan_name] = [None] * i
        results_by_plan[plan_name].append(result)
        i += 1

        # Pad the other field's lists with None values for this column
        for key in results_by_plan.keys():
            if key == plan_name:
                continue
            else:
                results_by_plan[key].append(None)

    results = []
    plan_keys = list(results_by_plan.keys())
    plan_keys.sort()
    for key in plan_keys:
        plan_results = []
        for result in results_by_plan[key]:
            plan_results.append(result)
        results.append((key[0], key[1], plan_results))

    headers = ["Plan", "Branch/Tag"]
    headers += [""] * i

    data = {
        "method": method,
        "headers": headers,
        "results": results,
        "all_results": latest_results,
    }

    return render(request, "testresults/test_method_trend.html", data)
Exemple #4
0
def org_list(request):
    query = {}
    repo = request.GET.get("repo")
    if repo:
        query["repo__name"] = repo
    scratch = request.GET.get("scratch")
    if scratch:
        query["scratch"] = scratch

    orgs = Org.objects.for_user(request.user).filter(**query)
    orgs = orgs.order_by("id")

    orgs = paginate(orgs, request)
    context = {"orgs": orgs}
    return render(request, "cumulusci/org_list.html", context=context)
Exemple #5
0
def test_method_peek(request, method_id):
    build_qs = Build.objects.for_user(request.user)
    method = get_object_or_404(TestMethod, id=method_id)
    latest_fails = (method.test_results.filter(
        outcome="Fail", build_flow__build__in=build_qs).order_by(
            "-build_flow__time_end").select_related(
                "build_flow",
                "build_flow__build",
                "build_flow__build__repo",
                "build_flow__build__plan",
                "build_flow__build__branch",
                "build_flow__build__branch__repo",
            ))
    latest_fails = paginate(latest_fails, request)

    data = {"method": method, "latest_fails": latest_fails}

    return render(request, "testresults/test_method_peek.html", data)