diff --git a/openstackclient/tests/functional/common/test_help.py b/openstackclient/tests/functional/common/test_help.py index 211c52b1de..e31d3b869c 100644 --- a/openstackclient/tests/functional/common/test_help.py +++ b/openstackclient/tests/functional/common/test_help.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import os + from openstackclient.tests.functional import base @@ -71,3 +73,48 @@ class HelpTests(base.TestCase): self.assertIn('List networks', raw_output) raw_output = self.openstack('network create --help') self.assertIn('Create new network', raw_output) + + def test_commands_help_no_auth(self): + """Check help commands without auth info.""" + # Pop all auth info + auth_info = {key: os.environ.pop(key) + for key in os.environ.keys() + if key.startswith('OS_')} + + raw_output = self.openstack('help') + self.assertIn('usage: openstack', raw_output) + raw_output = self.openstack('--help') + self.assertIn('usage: openstack', raw_output) + + raw_output = self.openstack('help network list') + self.assertIn('List networks', raw_output) + raw_output = self.openstack('network list --help') + self.assertIn('List networks', raw_output) + + raw_output = self.openstack('help volume list') + self.assertIn('List volumes', raw_output) + raw_output = self.openstack('volume list --help') + self.assertIn('List volumes', raw_output) + + raw_output = self.openstack('help server list') + self.assertIn('List servers', raw_output) + raw_output = self.openstack('server list --help') + self.assertIn('List servers', raw_output) + + raw_output = self.openstack('help user list') + self.assertIn('List users', raw_output) + raw_output = self.openstack('user list --help') + self.assertIn('List users', raw_output) + + raw_output = self.openstack('help image list') + self.assertIn('List available images', raw_output) + raw_output = self.openstack('image list --help') + self.assertIn('List available images', raw_output) + + raw_output = self.openstack('help container list') + self.assertIn('List containers', raw_output) + raw_output = self.openstack('container list --help') + self.assertIn('List containers', raw_output) + + # Restore auth info + os.environ.update(auth_info)