def download_bulk_app_translations(request, domain, app_id): app = get_app(domain, app_id) headers = expected_bulk_app_sheet_headers(app) rows = expected_bulk_app_sheet_rows(app) temp = StringIO() data = [(k, v) for k, v in rows.iteritems()] export_raw(headers, data, temp) return export_response(temp, Format.XLS_2007, "bulk_app_translations")
def test_download(self): actual_headers = expected_bulk_app_sheet_headers(self.app) actual_rows = expected_bulk_app_sheet_rows(self.app) actual_workbook = [{ 'name': title, 'rows': [dict(zip(headers, row)) for row in actual_rows[title]] } for title, headers in actual_headers] for actual_sheet, expected_sheet in zip(actual_workbook, self.expected_workbook): self.assertEqual(actual_sheet, expected_sheet) self.assertEqual(actual_workbook, self.expected_workbook)
def test_download(self): actual_headers = expected_bulk_app_sheet_headers(self.app) actual_rows = expected_bulk_app_sheet_rows(self.app) actual_workbook = [ {'name': title, 'rows': [dict(zip(headers, row)) for row in actual_rows[title]]} for title, headers in actual_headers ] for actual_sheet, expected_sheet in zip(actual_workbook, self.expected_workbook): self.assertEqual(actual_sheet, expected_sheet) self.assertEqual(actual_workbook, self.expected_workbook)