Skip to content

Commit

Permalink
Additional coverage and related bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
amstilp committed Feb 27, 2024
1 parent 36acc4f commit 66cbb7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions primed/dbgap/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4986,17 +4986,17 @@ def test_access_without_user_permission(self):
self.get_view()(request)

def test_dbgap_application_does_not_exist(self):
"""Raises a 404 error with an invalid object dbgap_application_pk."""
dbgap_workspace = factories.dbGaPWorkspaceFactory.create()
request = self.factory.get(
self.client.force_login(self.user)
response = self.client.get(
self.get_url(
1,
dbgap_workspace.workspace.billing_project.name,
dbgap_workspace.workspace.name,
)
)
request.user = self.user
with self.assertRaises(Http404):
self.get_view()(request)
self.assertEqual(response.status_code, 404)

def test_billing_project_does_not_exist(self):
dbgap_application = factories.dbGaPApplicationFactory.create()
Expand Down
5 changes: 1 addition & 4 deletions primed/dbgap/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,7 @@ def get_dbgap_application(self, queryset=None):
dbgap_project_id=self.kwargs.get("dbgap_project_id")
)
except models.dbGaPApplication.DoesNotExist:
raise Http404(
"No %(verbose_name)s found matching the query"
% {"verbose_name": queryset.model._meta.verbose_name}
)
raise Http404("No dbGaPApplications found matching the query")
return obj

def get_audit_result(self):
Expand Down

0 comments on commit 66cbb7c

Please sign in to comment.