diff options
author | Bin Yang <bin.yang@windriver.com> | 2017-09-30 00:02:32 +0800 |
---|---|---|
committer | Bin Yang <bin.yang@windriver.com> | 2017-09-30 00:02:32 +0800 |
commit | e7aa33e8215424508e5831cd91479e23a0c43e32 (patch) | |
tree | 26f14b61e040550efe4e0aa7e2bce46a3f09da1d /windriver/titanium_cloud/extensions/tests/test_extensions.py | |
parent | a9206ba5476eaaf0d4e5ab1f8fa6c5752f539882 (diff) |
Add UT for ocata and windriver
Change-Id: I6b921443cdd1181e1953962afeb11a706329c5e9
Issue-Id: MULTICLOUD-83
Signed-off-by: Bin Yang <bin.yang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/extensions/tests/test_extensions.py')
-rw-r--r-- | windriver/titanium_cloud/extensions/tests/test_extensions.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/windriver/titanium_cloud/extensions/tests/test_extensions.py b/windriver/titanium_cloud/extensions/tests/test_extensions.py new file mode 100644 index 00000000..93d990bb --- /dev/null +++ b/windriver/titanium_cloud/extensions/tests/test_extensions.py @@ -0,0 +1,45 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from django.test import Client +from rest_framework import status +import unittest + + +class TestExtensions(unittest.TestCase): + def setUp(self): + self.client = Client() + + def test_get_extensions_info(self): + cloud_owner = "windriver-hudson-dc" + cloud_region_id = "RegionOne" + vimid = cloud_owner + "_" + cloud_region_id + + response = self.client.get( + "/api/multicloud-titanium_cloud/v0/" + vimid + "/extensions/") + json_content = response.json() + + self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEquals(4, len(json_content.keys())) + + self.assertEquals(cloud_owner, json_content["cloud-owner"]) + self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) + self.assertEquals(vimid, json_content["vimid"]) + + self.assertEquals("epa-caps", json_content["extensions"][0]["alias"]) + self.assertEquals("Multiple network support", json_content["extensions"][0]["description"]) + self.assertEquals("EPACapsQuery", json_content["extensions"][0]["name"]) + self.assertEquals("http://127.0.0.1:80/api/multicloud-titanium_cloud/v0/%s/extensions/epa-caps" % vimid, + json_content["extensions"][0]["url"]) + self.assertEquals("", json_content["extensions"][0]["spec"])
\ No newline at end of file |