Esempio n. 1
0
    def get_context_data(self, **kwargs):
        data = super(TestingReportCaseRuns, self).get_context_data(**kwargs)

        query_args = self.request.GET
        form = self._get_form(query_args)

        if form.is_valid():
            test_case_runs = self.get_case_runs(form)
            status_names = TestCaseRunStatus.as_dict()
            priority_values = Priority.get_values()

            testers_ids, assignees_ids = self._get_testers_assignees_ids(
                test_case_runs)
            testers = self.get_related_testers(testers_ids)
            assignees = self.get_related_assignees(assignees_ids)

            data['test_case_runs_count'] = len(test_case_runs)
            data['test_case_runs'] = self.walk_case_runs(test_case_runs,
                                                         status_names,
                                                         priority_values,
                                                         testers,
                                                         assignees)
        else:
            data['form_errors'] = form.errors

        return data
Esempio n. 2
0
    def get_context_data(self, **kwargs):
        data = super(TestingReportCaseRuns, self).get_context_data(**kwargs)

        query_args = self.request.GET
        form = self._get_form(query_args)

        if form.is_valid():
            test_case_runs = self.get_case_runs(form)
            status_names = TestCaseRunStatus.get_names()
            priority_values = Priority.get_values()

            testers_ids, assignees_ids = self._get_testers_assignees_ids(
                test_case_runs)
            testers = self.get_related_testers(testers_ids)
            assignees = self.get_related_assignees(assignees_ids)

            data['test_case_runs_count'] = len(test_case_runs)
            data['test_case_runs'] = self.walk_case_runs(test_case_runs,
                                                         status_names,
                                                         priority_values,
                                                         testers,
                                                         assignees)
        else:
            data['form_errors'] = form.errors

        return data
Esempio n. 3
0
def filter(query):  # pylint: disable=invalid-name
    """
    .. function:: XML-RPC Priority.filter(query)

        Perform a search and return the resulting list of priorities.

        :param query: Field lookups for :class:`tcms.management.models.Priority`
        :type query: dict
        :return: Serialized list of :class:`tcms.management.models.Priority` objects
        :rtype: dict
    """
    return Priority.to_xmlrpc(query)
Esempio n. 4
0
File: views.py Progetto: xbln/Kiwi
    def walk_case_runs():
        """Walking case runs for helping rendering case runs table"""
        priorities = Priority.get_values()
        testers, assignees = open_run_get_users(tcrs)
        comments_subtotal = open_run_get_comments_subtotal(
            [cr.pk for cr in tcrs])
        case_run_status = TestCaseRunStatus.get_names()

        for case_run in tcrs:
            yield (case_run, testers.get(case_run.tested_by_id, None),
                   assignees.get(case_run.assignee_id, None),
                   priorities.get(case_run.case.priority_id),
                   case_run_status[case_run.case_run_status_id],
                   comments_subtotal.get(case_run.pk, 0))
Esempio n. 5
0
    def status_matrix(self, form):
        sql, params = self._prepare_sql(form, sqls.by_case_priority_subtotal)
        sql_executor = SQLExecution(sql, params, with_field_name=False)
        rows = sql_executor.rows

        builds = GroupByResult()

        for build_id, priority_id, priority_value, name, total_count in rows:
            priorities = builds.setdefault(build_id, GroupByResult())
            priority = Priority(pk=priority_id, value=priority_value)
            status_subtotal = priorities.setdefault(priority, GroupByResult())
            status_subtotal[name] = total_count

        return builds
Esempio n. 6
0
    def status_matrix(self, form):
        builds = GroupByResult()
        query = self._filter_query(
            form,
            TestCaseRun.objects.values(
                'build', 'case__priority', 'case__priority__value',
                'case_run_status__name').annotate(total_count=Count('pk')))

        for row in query:
            build_id = row['build']
            priority_id = row['case__priority']
            priority_value = row['case__priority__value']
            name = row['case_run_status__name']
            total_count = row['total_count']
            priorities = builds.setdefault(build_id, GroupByResult())
            priority = Priority(pk=priority_id, value=priority_value)
            status_subtotal = priorities.setdefault(priority, GroupByResult())
            status_subtotal[name] = total_count

        return builds