This is an automated email from the ASF dual-hosted git repository.

yasithdev pushed a commit to branch feat/generic-experiment-launcher
in repository https://gitbox.apache.org/repos/asf/airavata-portals.git

commit 86d5544cd17529eeb4660e43a4b636dc0ada6348
Author: yasithdev <[email protected]>
AuthorDate: Fri Apr 24 21:40:56 2026 -0400

    fix(launcher): standardize 404 body via DRF NotFound + add missing test 
coverage
---
 airavata-django-portal/django_airavata/apps/api/launcher_views.py  | 5 +++--
 .../django_airavata/apps/api/tests/test_launcher_views.py          | 7 +++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/airavata-django-portal/django_airavata/apps/api/launcher_views.py 
b/airavata-django-portal/django_airavata/apps/api/launcher_views.py
index 7c23d0a69..f0b39ba3a 100644
--- a/airavata-django-portal/django_airavata/apps/api/launcher_views.py
+++ b/airavata-django-portal/django_airavata/apps/api/launcher_views.py
@@ -1,5 +1,6 @@
-from rest_framework import permissions, status
+from rest_framework import permissions
 from rest_framework.decorators import api_view, permission_classes
+from rest_framework.exceptions import NotFound
 from rest_framework.request import Request
 from rest_framework.response import Response
 
@@ -26,7 +27,7 @@ def application_detail(request: Request, app_id: str) -> 
Response:
     try:
         return Response(_client(request).get_application(app_id=app_id))
     except LookupError:
-        return Response({"detail": "not found"}, 
status=status.HTTP_404_NOT_FOUND)
+        raise NotFound()
 
 
 @api_view(["GET"])
diff --git 
a/airavata-django-portal/django_airavata/apps/api/tests/test_launcher_views.py 
b/airavata-django-portal/django_airavata/apps/api/tests/test_launcher_views.py
index ae4e35c9c..e328b936a 100644
--- 
a/airavata-django-portal/django_airavata/apps/api/tests/test_launcher_views.py
+++ 
b/airavata-django-portal/django_airavata/apps/api/tests/test_launcher_views.py
@@ -35,6 +35,12 @@ class LauncherListingViewsTest(APITestCase):
         self.assertEqual(resp.status_code, 200)
         self.assertEqual(resp.json()["app_id"], "namd")
 
+    @override_settings(LAUNCHER_CLIENT_STUB=True)
+    def test_application_detail_not_found(self):
+        resp = self.client.get("/api/launcher/applications/does-not-exist/")
+        self.assertEqual(resp.status_code, 404)
+        self.assertIn("detail", resp.json())
+
     @override_settings(LAUNCHER_CLIENT_STUB=True)
     def test_resource_profile_for_project(self):
         resp = 
self.client.get("/api/launcher/projects/proj-1/resource-profile/")
@@ -61,6 +67,7 @@ class LauncherListingViewsTest(APITestCase):
         self.assertIn("project_id", body["results"][0])
         self.assertIn("name", body["results"][0])
 
+    @override_settings(LAUNCHER_CLIENT_STUB=True)
     def test_endpoints_require_auth(self):
         # Clear the forced authentication so the requests are anonymous.
         self.client.force_authenticate(user=None)

Reply via email to