From 78a1836404c1a1f2f72af11640a7c3690367d02b Mon Sep 17 00:00:00 2001 From: Yohanna Lisnichuk Date: Thu, 9 Nov 2023 13:59:55 -0300 Subject: [PATCH] Apply suggestions from code review Co-authored-by: James McKinney <26463+jpmckinney@users.noreply.github.com> --- exporter/views.py | 4 ++-- tests/exporter/test_views.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exporter/views.py b/exporter/views.py index d8b8d12c..45496e83 100644 --- a/exporter/views.py +++ b/exporter/views.py @@ -20,9 +20,9 @@ def download_export(request, id): active_job = collection.job.filter(active=True).first() if not active_job: - return HttpResponseNotFound("No active job was found for this collection") + return HttpResponseNotFound("This OCDS dataset is not available for download") - export = Export(active_job.id, basename=f"{name}") + export = Export(active_job.id, basename=name) if export.status != TaskStatus.COMPLETED: return HttpResponseNotFound("File not found") diff --git a/tests/exporter/test_views.py b/tests/exporter/test_views.py index 3266f983..5d8af146 100644 --- a/tests/exporter/test_views.py +++ b/tests/exporter/test_views.py @@ -25,14 +25,14 @@ def test_download_export_invalid_suffix(self): response = Client().get("/publication/2/download?name=invalid") self.assertEqual(response.status_code, 400) - self.assertEqual(response.content, b"Suffix not recognized") + self.assertEqual(response.content, b"The name query string parameter is invalid") def test_download_export_empty_parameter(self): with self.assertNumQueries(0): response = Client().get("/publication/2/download?name=") self.assertEqual(response.status_code, 400) - self.assertEqual(response.content, b"Suffix not recognized") + self.assertEqual(response.content, b"The name query string parameter is invalid") def test_download_export_waiting(self): with self.assertNumQueries(1):