From bb866d4d7505a7323662c238fb3f855ee04f99dc Mon Sep 17 00:00:00 2001 From: Mark Vanderwiel Date: Fri, 29 Jan 2016 15:52:59 -0600 Subject: [PATCH] Add openstack client stack basic funtion tests Based from the existing heat function tests. Can be expanded in the future with more then read-only tests. For now just get the tests working with openstack client. Change-Id: I1b84085b89c429b4b25f75d76d5c4b7b56d25326 Blueprint: heat-support-python-openstackclient --- heatclient/tests/functional/base.py | 3 ++ heatclient/tests/functional/osc/__init__.py | 0 .../tests/functional/osc/v1/__init__.py | 0 .../tests/functional/osc/v1/test_readonly.py | 40 +++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 heatclient/tests/functional/osc/__init__.py create mode 100644 heatclient/tests/functional/osc/v1/__init__.py create mode 100644 heatclient/tests/functional/osc/v1/test_readonly.py diff --git a/heatclient/tests/functional/base.py b/heatclient/tests/functional/base.py index 44718cad..b0d8a8ed 100644 --- a/heatclient/tests/functional/base.py +++ b/heatclient/tests/functional/base.py @@ -40,3 +40,6 @@ class ClientTestBase(base.ClientTestBase): def heat(self, *args, **kwargs): return self.clients.heat(*args, **kwargs) + + def openstack(self, *args, **kwargs): + return self.clients.openstack(*args, **kwargs) diff --git a/heatclient/tests/functional/osc/__init__.py b/heatclient/tests/functional/osc/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/heatclient/tests/functional/osc/v1/__init__.py b/heatclient/tests/functional/osc/v1/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/heatclient/tests/functional/osc/v1/test_readonly.py b/heatclient/tests/functional/osc/v1/test_readonly.py new file mode 100644 index 00000000..3c70a47d --- /dev/null +++ b/heatclient/tests/functional/osc/v1/test_readonly.py @@ -0,0 +1,40 @@ +# 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 tempest_lib import exceptions + +from heatclient.tests.functional import base + + +class SimpleReadOnlyOpenStackClientTest(base.ClientTestBase): + """Basic, read-only tests for Openstack CLI client heat plugin. + + Basic smoke test for the openstack CLI commands which do not require + creating or modifying stacks. + """ + + def test_openstack_fake_action(self): + self.assertRaises(exceptions.CommandFailed, + self.openstack, + 'this-does-not-exist') + + def test_openstack_stack_list(self): + self.openstack('stack list') + + def test_openstack_stack_list_debug(self): + self.openstack('stack list', flags='--debug') + + def test_openstack_help_cmd(self): + self.openstack('help stack') + + def test_openstack_version(self): + self.openstack('', flags='--version')