+# Copyright 2017 ZTE Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+import uuid\r
+\r
+from django.test import TestCase, Client\r
+from rest_framework import status\r
+\r
+from lcm.pub.database.models import NSInstModel\r
+\r
+\r
+class TestNsQuery(TestCase):\r
+ def setUp(self):\r
+ self.client = Client()\r
+ self.nsd_id = str(uuid.uuid4())\r
+ self.ns_package_id = str(uuid.uuid4())\r
+ NSInstModel(id=1, nsd_id=1, name='test01').save()\r
+ NSInstModel(id=2, nsd_id=1, name='test02').save()\r
+\r
+ def test_query_ns_by_csarId(self):\r
+ response = self.client.get("/api/nslcm/v1/ns?csarId=1")\r
+ self.failUnlessEqual(status.HTTP_200_OK, response.status_code)\r
+\r
+\r
+ def test_query_ns_by_nsinstance_id(self):\r
+ response = self.client.get("/api/nslcm/v1/ns/1")\r
+ self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
\ No newline at end of file