summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Vanderwiel <vanderwl@us.ibm.com>2016-02-12 13:53:02 -0600
committerMark Vanderwiel <vanderwl@us.ibm.com>2016-02-26 09:46:50 -0600
commit4a6b4e482296d7ade8a37eb852500e0512fdf149 (patch)
treeda1fb26dd996d379335174ae37c93d0235b38731
parent0a7f8bf1d6c802db673c0956f30a41b29626196f (diff)
downloadpython-heatclient-4a6b4e482296d7ade8a37eb852500e0512fdf149.tar.gz
Add more readonly openstack client funcitonal tests
Added a few more basic tests Blueprint: heat-support-python-openstackclient Change-Id: Ifbc97d849c23cd622b62b52b84d8634b8c8658db
-rw-r--r--heatclient/tests/functional/osc/v1/test_readonly.py81
1 files changed, 78 insertions, 3 deletions
diff --git a/heatclient/tests/functional/osc/v1/test_readonly.py b/heatclient/tests/functional/osc/v1/test_readonly.py
index 3c70a47..988823e 100644
--- a/heatclient/tests/functional/osc/v1/test_readonly.py
+++ b/heatclient/tests/functional/osc/v1/test_readonly.py
@@ -10,6 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+import os
+import yaml
+
from tempest_lib import exceptions
from heatclient.tests.functional import base
@@ -27,14 +30,86 @@ class SimpleReadOnlyOpenStackClientTest(base.ClientTestBase):
self.openstack,
'this-does-not-exist')
- def test_openstack_stack_list(self):
- self.openstack('stack list')
+ # Empty list commands
+ def test_openstack_empty_lists(self):
+ cmds = [
+ 'software config',
+ 'software deployment',
+ 'stack',
+ ]
+ for cmd in cmds:
+ self.openstack(cmd + ' list')
+
+ # Stack not found commands
+ def test_openstack_stack_not_found(self):
+ cmds = [
+ 'stack abandon',
+ 'stack check',
+ 'stack output list',
+ 'stack resume',
+ 'stack show',
+ 'stack snapshot list',
+ 'stack suspend',
+ 'stack template show',
+ 'stack cancel'
+ ]
+ for cmd in cmds:
+ err = self.assertRaises(exceptions.CommandFailed,
+ self.openstack,
+ cmd + ' I-AM-NOT-FOUND')
+ self.assertIn('Stack not found: I-AM-NOT-FOUND', str(err))
def test_openstack_stack_list_debug(self):
self.openstack('stack list', flags='--debug')
def test_openstack_help_cmd(self):
- self.openstack('help stack')
+ help_text = self.openstack('help stack list')
+ lines = help_text.split('\n')
+ self.assertFirstLineStartsWith(lines, 'usage: openstack stack list')
def test_openstack_version(self):
self.openstack('', flags='--version')
+
+ def test_openstack_template_version_list(self):
+ ret = self.openstack('orchestration template version list')
+ tmpl_types = self.parser.listing(ret)
+ self.assertTableStruct(tmpl_types, ['version', 'type'])
+
+ def test_openstack_template_function_list(self):
+ ret = self.openstack('orchestration template function list '
+ 'heat_template_version.2015-10-15')
+ tmpl_functions = self.parser.listing(ret)
+ self.assertTableStruct(tmpl_functions, ['functions', 'description'])
+
+ def test_openstack_resource_type_list(self):
+ ret = self.openstack('orchestration resource type list')
+ rsrc_types = self.parser.listing(ret)
+ self.assertTableStruct(rsrc_types, ['Resource Type'])
+
+ def test_openstack_resource_type_show(self):
+ rsrc_schema = self.openstack('orchestration resource type show '
+ 'OS::Heat::RandomString')
+ self.assertIsInstance(yaml.load(rsrc_schema), dict)
+
+ def _template_validate(self, templ_name, parms):
+ heat_template_path = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ '../../templates/%s' % templ_name)
+ cmd = 'stack create test-stack --dry-run --template %s'\
+ % heat_template_path
+ for parm in parms:
+ cmd += ' --parameter ' + parm
+ ret = self.openstack(cmd)
+ self.assertRegexpMatches(ret, r'stack_name.*|.*test_stack')
+
+ def test_heat_template_validate_yaml(self):
+ self._template_validate(
+ 'heat_minimal.yaml',
+ ['ClientName=ClientName', 'WaitSecs=123']
+ )
+
+ def test_heat_template_validate_hot(self):
+ self._template_validate(
+ 'heat_minimal_hot.yaml',
+ ['test_client_name=test_client_name', 'test_wait_secs=123']
+ )