Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: James McKinney <[email protected]>
  • Loading branch information
yolile and jpmckinney authored Nov 9, 2023
1 parent 462d9b3 commit 78a1836
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions exporter/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions tests/exporter/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 78a1836

Please sign in to comment.