1 # Copyright (c) 2019, CMCC Technologies Co., Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
17 from django.test import TestCase, Client
18 from rest_framework import status
21 class TestHealthCheck(TestCase):
23 self.client = Client()
28 def test_vnfpkgm_health_check(self):
29 response = self.client.get("/api/vnfpkgm/v1/health_check")
30 self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
31 resp_data = json.loads(response.content)
32 self.assertEqual({"status": "active"}, resp_data)
34 def test_nsd_health_check(self):
35 response = self.client.get("/api/nsd/v1/health_check")
36 self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
37 resp_data = json.loads(response.content)
38 self.assertEqual({"status": "active"}, resp_data)
40 def test_catalog_health_check(self):
41 response = self.client.get("/api/catalog/v1/health_check")
42 self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
43 resp_data = json.loads(response.content)
44 self.assertEqual({"status": "active"}, resp_data)
46 def test_parser_health_check(self):
47 response = self.client.get("/api/parser/v1/health_check")
48 self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
49 resp_data = json.loads(response.content)
50 self.assertEqual({"status": "active"}, resp_data)