summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/common
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2017-04-28 12:41:57 -0500
committerDean Troyer <dtroyer@gmail.com>2017-04-28 14:40:45 -0500
commit190711ecd71af2eff4683e570ef48f041fa8d91b (patch)
tree8aed52cb833e497bee822fb4700759c532414f1d /openstackclient/tests/functional/common
parentefcf3b22ad22152331f7a42f0bfc4cc67205b8da (diff)
downloadpython-openstackclient-190711ecd71af2eff4683e570ef48f041fa8d91b.tar.gz
Nova net functional tests round 3
* network segment * network service * port * router * security group * security group rule * subnet * subnet pool * extension The extension tests were duplicated to have both compute and network extensions tests so the nova-net case will still exercise the extension commands. Also clean up formatting from previous reviews to make the Network functional tests look and act consistently. Change-Id: I286c40572faa31ddcef595cec740da933b2defc1
Diffstat (limited to 'openstackclient/tests/functional/common')
-rw-r--r--openstackclient/tests/functional/common/test_extension.py65
1 files changed, 53 insertions, 12 deletions
diff --git a/openstackclient/tests/functional/common/test_extension.py b/openstackclient/tests/functional/common/test_extension.py
index 7c527eae..cc4cb7e1 100644
--- a/openstackclient/tests/functional/common/test_extension.py
+++ b/openstackclient/tests/functional/common/test_extension.py
@@ -18,25 +18,66 @@ import json
from openstackclient.tests.functional import base
-class TestExtension(base.TestCase):
- """Functional tests for extension."""
+class ExtensionTests(base.TestCase):
+ """Functional tests for extension"""
- def test_extension_list(self):
- """Test extension list."""
+ @classmethod
+ def setUpClass(cls):
+ # super(NetworkTests, cls).setUp()
+ cls.haz_network = base.is_service_enabled('network')
+
+ def test_extension_list_compute(self):
+ """Test compute extension list"""
json_output = json.loads(self.openstack(
- 'extension list -f json ' + '--network')
+ 'extension list -f json ' +
+ '--compute'
+ ))
+ name_list = [item.get('Name') for item in json_output]
+ self.assertIn(
+ 'ImageSize',
+ name_list,
)
- self.assertEqual(
+
+ def test_extension_list_network(self):
+ """Test network extension list"""
+ if not self.haz_network:
+ self.skipTest("No Network service present")
+
+ json_output = json.loads(self.openstack(
+ 'extension list -f json ' +
+ '--network'
+ ))
+ name_list = [item.get('Name') for item in json_output]
+ self.assertIn(
'Default Subnetpools',
- json_output[0]['Name'],
+ name_list,
)
- def test_extension_show(self):
- """Test extension show."""
+ # NOTE(dtroyer): Only network extensions are currently supported but
+ # I am going to leave this here anyway as a reminder
+ # fix that.
+ # def test_extension_show_compute(self):
+ # """Test compute extension show"""
+ # json_output = json.loads(self.openstack(
+ # 'extension show -f json ' +
+ # 'ImageSize'
+ # ))
+ # self.assertEqual(
+ # 'OS-EXT-IMG-SIZE',
+ # json_output.get('Alias'),
+ # )
+
+ def test_extension_show_network(self):
+ """Test network extension show"""
+ if not self.haz_network:
+ self.skipTest("No Network service present")
+
name = 'agent'
json_output = json.loads(self.openstack(
- 'extension show -f json ' + name)
- )
+ 'extension show -f json ' +
+ name
+ ))
self.assertEqual(
name,
- json_output.get('Alias'))
+ json_output.get('Alias'),
+ )