From 190711ecd71af2eff4683e570ef48f041fa8d91b Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 28 Apr 2017 12:41:57 -0500 Subject: 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 --- .../tests/functional/common/test_extension.py | 65 ++++++++++++++++++---- 1 file changed, 53 insertions(+), 12 deletions(-) (limited to 'openstackclient/tests/functional/common') 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'), + ) -- cgit v1.2.1