1 # Copyright 2017 ZTE Corporation.
\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
7 # http://www.apache.org/licenses/LICENSE-2.0
\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
16 from django.test import TestCase, Client
\r
17 from rest_framework import status
\r
19 from lcm.pub.database.models import NSInstModel
\r
22 class TestNsQuery(TestCase):
\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
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
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)