diff options
| author | Rui Chen <chenrui.momo@gmail.com> | 2017-04-01 14:52:21 +0800 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2017-04-03 16:27:25 +0000 |
| commit | 341f07582ef5aa782c817ab2feab5828ac15c003 (patch) | |
| tree | 29be1f623c9d3dded984bc2b4981da5a124c2703 /openstackclient/tests/functional/common | |
| parent | 659115448803f1a6181ad0f592e0b61a86ad83fc (diff) | |
| download | python-openstackclient-341f07582ef5aa782c817ab2feab5828ac15c003.tar.gz | |
Add help commands withouth auth in functional
A special scenairo is that users want to check the commands
help message, but don't set authentication info at all. Add
a related functional test case to cover it.
Change-Id: I7b09701df24d6f6dfcf369f89212f72e753be6e4
Diffstat (limited to 'openstackclient/tests/functional/common')
| -rw-r--r-- | openstackclient/tests/functional/common/test_help.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/common/test_help.py b/openstackclient/tests/functional/common/test_help.py index 211c52b1..e31d3b86 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) |
