def _MakeTableData(issues, starred_iid_set, lower_columns, lower_group_by, users_by_id, cell_factories, related_issues, config, context_for_all_issues, hotlist_id, sort_spec): """Returns data from MakeTableData after adding additional information.""" table_data = table_view_helpers.MakeTableData( issues, starred_iid_set, lower_columns, lower_group_by, users_by_id, cell_factories, lambda issue: issue.issue_id, related_issues, config, context_for_all_issues) for row, art in zip(table_data, issues): row.issue_id = art.issue_id row.local_id = art.local_id row.project_name = art.project_name row.project_url = framework_helpers.FormatURL( None, '/p/%s' % row.project_name) row.issue_ref = '%s:%d' % (art.project_name, art.local_id) row.issue_clean_url = tracker_helpers.FormatRelativeIssueURL( art.project_name, urls.ISSUE_DETAIL, id=art.local_id) row.issue_ctx_url = tracker_helpers.FormatRelativeIssueURL( art.project_name, urls.ISSUE_DETAIL, id=art.local_id, sort=sort_spec, hotlist_id=hotlist_id) return table_data
def testMakeTableData_Groups(self): art = fake.MakeTestIssue(789, 1, 'sum 1', 'New', 111, labels='Type-Defect Priority-Medium') visible_results = [art] lower_columns = ['type', 'priority', 'summary', 'stars'] lower_group_by = ['priority'] cell_factories = { 'summary': table_view_helpers.TableCellSummary, 'stars': table_view_helpers.TableCellStars, } table_data = table_view_helpers.MakeTableData(visible_results, [], lower_columns, lower_group_by, {}, cell_factories, lambda art: 'id', {}, set(), self.config) self.assertEqual(1, len(table_data)) row = table_data[0] self.assertEqual(1, len(row.group.cells)) self.assertEqual('Medium', row.group.cells[0].values[0].item)
def testMakeTableData_Empty(self): visible_results = [] lower_columns = [] cell_factories = {} table_data = table_view_helpers.MakeTableData( visible_results, [], lower_columns, lower_columns, cell_factories, [], 'unused function', {}, self.config) self.assertEqual([], table_data) lower_columns = ['type', 'priority', 'summary', 'stars'] cell_factories = { 'summary': table_view_helpers.TableCellSummary, 'stars': table_view_helpers.TableCellStars, } table_data = table_view_helpers.MakeTableData( visible_results, [], lower_columns, [], {}, cell_factories, 'unused function', {}, self.config) self.assertEqual([], table_data)
def _MakeTableData( visible_results, starred_iid_set, lower_columns, lower_group_by, users_by_id, cell_factories, related_issues, viewable_iids_set, config): """Return a list of list row objects for display by EZT.""" table_data = table_view_helpers.MakeTableData( visible_results, starred_iid_set, lower_columns, lower_group_by, users_by_id, cell_factories, lambda issue: issue.issue_id, related_issues, viewable_iids_set, config) for row, art in zip(table_data, visible_results): row.local_id = art.local_id row.project_name = art.project_name row.issue_ref = '%s:%d' % (art.project_name, art.local_id) row.issue_url = tracker_helpers.FormatRelativeIssueURL( art.project_name, urls.ISSUE_DETAIL, id=art.local_id) row.crbug_url = tracker_helpers.FormatCrBugURL( art.project_name, art.local_id) return table_data