|
10 | 10 | # License for the specific language governing permissions and limitations |
11 | 11 | # under the License. |
12 | 12 |
|
| 13 | +import os |
| 14 | + |
13 | 15 | from openstackclient.tests.functional import base |
14 | 16 |
|
15 | 17 |
|
@@ -71,3 +73,48 @@ def test_networking_commands_help(self): |
71 | 73 | self.assertIn('List networks', raw_output) |
72 | 74 | raw_output = self.openstack('network create --help') |
73 | 75 | self.assertIn('Create new network', raw_output) |
| 76 | + |
| 77 | + def test_commands_help_no_auth(self): |
| 78 | + """Check help commands without auth info.""" |
| 79 | + # Pop all auth info |
| 80 | + auth_info = {key: os.environ.pop(key) |
| 81 | + for key in os.environ.keys() |
| 82 | + if key.startswith('OS_')} |
| 83 | + |
| 84 | + raw_output = self.openstack('help') |
| 85 | + self.assertIn('usage: openstack', raw_output) |
| 86 | + raw_output = self.openstack('--help') |
| 87 | + self.assertIn('usage: openstack', raw_output) |
| 88 | + |
| 89 | + raw_output = self.openstack('help network list') |
| 90 | + self.assertIn('List networks', raw_output) |
| 91 | + raw_output = self.openstack('network list --help') |
| 92 | + self.assertIn('List networks', raw_output) |
| 93 | + |
| 94 | + raw_output = self.openstack('help volume list') |
| 95 | + self.assertIn('List volumes', raw_output) |
| 96 | + raw_output = self.openstack('volume list --help') |
| 97 | + self.assertIn('List volumes', raw_output) |
| 98 | + |
| 99 | + raw_output = self.openstack('help server list') |
| 100 | + self.assertIn('List servers', raw_output) |
| 101 | + raw_output = self.openstack('server list --help') |
| 102 | + self.assertIn('List servers', raw_output) |
| 103 | + |
| 104 | + raw_output = self.openstack('help user list') |
| 105 | + self.assertIn('List users', raw_output) |
| 106 | + raw_output = self.openstack('user list --help') |
| 107 | + self.assertIn('List users', raw_output) |
| 108 | + |
| 109 | + raw_output = self.openstack('help image list') |
| 110 | + self.assertIn('List available images', raw_output) |
| 111 | + raw_output = self.openstack('image list --help') |
| 112 | + self.assertIn('List available images', raw_output) |
| 113 | + |
| 114 | + raw_output = self.openstack('help container list') |
| 115 | + self.assertIn('List containers', raw_output) |
| 116 | + raw_output = self.openstack('container list --help') |
| 117 | + self.assertIn('List containers', raw_output) |
| 118 | + |
| 119 | + # Restore auth info |
| 120 | + os.environ.update(auth_info) |
0 commit comments