Fixed the csv_download function when downloading data with non-US-ASCII filenames in the "accounting.report.utils.csv_export" module.

This commit is contained in:
2023-04-09 12:07:31 +08:00
parent 5d87205659
commit 3a8618f7c3
2 changed files with 24 additions and 1 deletions

View File

@ -132,6 +132,12 @@ class ReportTestCase(unittest.TestCase):
response = client.get(f"{PREFIX}/search?q=Salary&as=csv")
self.assertEqual(response.status_code, 403)
response = client.get(f"{PREFIX}/search?q=薪水")
self.assertEqual(response.status_code, 403)
response = client.get(f"{PREFIX}/search?q=薪水&as=csv")
self.assertEqual(response.status_code, 403)
def test_viewer(self) -> None:
"""Test the permission as viewer.
@ -221,6 +227,14 @@ class ReportTestCase(unittest.TestCase):
self.assertEqual(response.headers["Content-Type"],
"text/csv; charset=utf-8")
response = client.get(f"{PREFIX}/search?q=薪水")
self.assertEqual(response.status_code, 200)
response = client.get(f"{PREFIX}/search?q=薪水&as=csv")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.headers["Content-Type"],
"text/csv; charset=utf-8")
def test_editor(self) -> None:
"""Test the permission as editor.
@ -310,6 +324,14 @@ class ReportTestCase(unittest.TestCase):
self.assertEqual(response.headers["Content-Type"],
"text/csv; charset=utf-8")
response = self.client.get(f"{PREFIX}/search?q=薪水")
self.assertEqual(response.status_code, 200)
response = self.client.get(f"{PREFIX}/search?q=薪水&as=csv")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.headers["Content-Type"],
"text/csv; charset=utf-8")
def test_empty_db(self) -> None:
"""Tests the empty database.