add VFC NS query via CSARID
[vfc/nfvo/lcm.git] / lcm / ns / tests / test_ns_get.py
1 # Copyright 2017 ZTE Corporation.\r
2 #\r
3 # Licensed under the Apache License, Version 2.0 (the "License");\r
4 # you may not use this file except in compliance with the License.\r
5 # You may obtain a copy of the License at\r
6 #\r
7 #         http://www.apache.org/licenses/LICENSE-2.0\r
8 #\r
9 # Unless required by applicable law or agreed to in writing, software\r
10 # distributed under the License is distributed on an "AS IS" BASIS,\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
12 # See the License for the specific language governing permissions and\r
13 # limitations under the License.\r
14 import uuid\r
15 \r
16 from django.test import TestCase, Client\r
17 from rest_framework import status\r
18 \r
19 from lcm.pub.database.models import NSInstModel\r
20 \r
21 \r
22 class TestNsQuery(TestCase):\r
23     def setUp(self):\r
24         self.client = Client()\r
25         self.nsd_id = str(uuid.uuid4())\r
26         self.ns_package_id = str(uuid.uuid4())\r
27         NSInstModel(id=1, nsd_id=1, name='test01').save()\r
28         NSInstModel(id=2, nsd_id=1, name='test02').save()\r
29 \r
30     def test_query_ns_by_csarId(self):\r
31         response = self.client.get("/api/nslcm/v1/ns?csarId=1")\r
32         self.failUnlessEqual(status.HTTP_200_OK, response.status_code)\r
33 \r
34 \r
35     def test_query_ns_by_nsinstance_id(self):\r
36         response = self.client.get("/api/nslcm/v1/ns/1")\r
37         self.failUnlessEqual(status.HTTP_200_OK, response.status_code)