summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/common
diff options
context:
space:
mode:
authorAnkur Gupta <ankur.gupta@intel.com>2017-03-24 12:39:22 -0500
committerRui Chen <chenrui.momo@gmail.com>2017-05-18 11:33:45 +0800
commitacc2d106abfb4fed0ff5d0d0c246d69f9ea1758b (patch)
tree9743c7f9fcf87b05b1f09598a9451a2cc8a38214 /openstackclient/tests/functional/common
parent0181de38afc8cc4b96f226b00e173fb0c0d2e4dc (diff)
downloadpython-openstackclient-acc2d106abfb4fed0ff5d0d0c246d69f9ea1758b.tar.gz
Refactor Extension show and list command
1.keep the column display order consist in extension list with and without "--long" option. 2.rework for network extentsion list, openstacksdk return object, so the logic should be same with other service. 3.add some unit test cases, like: extension list --network --long, extension list --network --compute, to cover regular use cases. 4.raise exact exception when network extension don't exist, avoid internal TypeError in "extension show" commands. Change-Id: I2e23ced80d8da8aa1106b22472db850367b351ce Closes-Bug: #1689233
Diffstat (limited to 'openstackclient/tests/functional/common')
-rw-r--r--openstackclient/tests/functional/common/test_extension.py31
1 files changed, 29 insertions, 2 deletions
diff --git a/openstackclient/tests/functional/common/test_extension.py b/openstackclient/tests/functional/common/test_extension.py
index cc4cb7e1..d7dc398b 100644
--- a/openstackclient/tests/functional/common/test_extension.py
+++ b/openstackclient/tests/functional/common/test_extension.py
@@ -15,6 +15,8 @@
import json
+from tempest.lib import exceptions as tempest_exc
+
from openstackclient.tests.functional import base
@@ -23,7 +25,6 @@ class ExtensionTests(base.TestCase):
@classmethod
def setUpClass(cls):
- # super(NetworkTests, cls).setUp()
cls.haz_network = base.is_service_enabled('network')
def test_extension_list_compute(self):
@@ -38,6 +39,18 @@ class ExtensionTests(base.TestCase):
name_list,
)
+ def test_extension_list_volume(self):
+ """Test volume extension list"""
+ json_output = json.loads(self.openstack(
+ 'extension list -f json ' +
+ '--volume'
+ ))
+ name_list = [item.get('Name') for item in json_output]
+ self.assertIn(
+ 'TypesManage',
+ name_list,
+ )
+
def test_extension_list_network(self):
"""Test network extension list"""
if not self.haz_network:
@@ -79,5 +92,19 @@ class ExtensionTests(base.TestCase):
))
self.assertEqual(
name,
- json_output.get('Alias'),
+ json_output.get('alias'),
)
+
+ def test_extension_show_not_exist(self):
+ """Test extension show with not existed name"""
+ if not self.haz_network:
+ self.skipTest("No Network service present")
+
+ name = 'not_existed_ext'
+ try:
+ self.openstack('extension show ' + name)
+ except tempest_exc.CommandFailed as e:
+ self.assertIn('ResourceNotFound', str(e))
+ self.assertIn(name, str(e))
+ else:
+ self.fail('CommandFailed should be raised')