return 404 instead of 500 if subscription does not exist
[modeling/etsicatalog.git] / catalog / packages / tests / test_nsdm_subscription.py
index d1e8770..0d73afd 100644 (file)
@@ -158,7 +158,7 @@ class TestNsdmSubscription(TestCase):
                          response.data["callbackUri"])
         expected_data = {
             'status': 303,
-            'detail': 'Already Subscription exists with'
+            'detail': 'Subscription has already existed with'
                       ' the same callbackUri and filter'
         }
         response = self.client.post("/api/nsd/v1/subscriptions",
@@ -465,7 +465,7 @@ class TestNsdmSubscription(TestCase):
         expected_data = {
             "status": 404,
             "detail": "Subscription(" + self.subscription_id + ") "
-            "doesn't exists"
+            "doesn't exist"
         }
         response = self.client.get('/api/nsd/v1/'
                                    'subscriptions/' + self.subscription_id,
@@ -476,7 +476,7 @@ class TestNsdmSubscription(TestCase):
     def test_nsdm_get_subscription_failure_bad_request(self):
         response = self.client.get("/api/nsd/v1/subscriptions/123",
                                    format='json')
-        self.assertEqual(status.HTTP_400_BAD_REQUEST, response.status_code)
+        self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code)
 
     @mock.patch.object(NsdmSubscription, 'query_single_subscription')
     def test_nsdmsubscription_getsingle_when_catch_exception(
@@ -518,7 +518,7 @@ class TestNsdmSubscription(TestCase):
     def test_nsdm_delete_subscription_failure_bad_request(self):
         response = self.client.delete("/api/nsd/v1/subscriptions/123",
                                       format='json')
-        self.assertEqual(status.HTTP_400_BAD_REQUEST, response.status_code)
+        self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code)
 
     @mock.patch.object(NsdmSubscription, 'delete_single_subscription')
     def test_nsdmsubscription_delete_when_catch_exception(self, mock_create):