Skip to content

Commit ad3af0e

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Functional tests for openstackclient help messages"
2 parents 3ccc4f7 + 89182c4 commit ad3af0e

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
from functional.common import test
14+
15+
16+
class HelpTests(test.TestCase):
17+
"""Functional tests for openstackclient help output."""
18+
19+
SERVER_COMMANDS = [
20+
('server add security group', 'Add security group to server'),
21+
('server add volume', 'Add volume to server'),
22+
('server create', 'Create a new server'),
23+
('server delete', 'Delete server(s)'),
24+
('server dump create', 'Create a dump file in server(s)'),
25+
('server image create',
26+
'Create a new disk image from a running server'),
27+
('server list', 'List servers'),
28+
('server lock',
29+
'Lock server(s). '
30+
'A non-admin user will not be able to execute actions'),
31+
('server migrate', 'Migrate server to different host'),
32+
('server pause', 'Pause server(s)'),
33+
('server reboot', 'Perform a hard or soft server reboot'),
34+
('server rebuild', 'Rebuild server'),
35+
('server remove security group', 'Remove security group from server'),
36+
('server remove volume', 'Remove volume from server'),
37+
('server rescue', 'Put server in rescue mode'),
38+
('server resize', 'Scale server to a new flavor'),
39+
('server resume', 'Resume server(s)'),
40+
('server set', 'Set server properties'),
41+
('server shelve', 'Shelve server(s)'),
42+
('server show', 'Show server details'),
43+
('server ssh', 'SSH to server'),
44+
('server start', 'Start server(s).'),
45+
('server stop', 'Stop server(s).'),
46+
('server suspend', 'Suspend server(s)'),
47+
('server unlock', 'Unlock server(s)'),
48+
('server unpause', 'Unpause server(s)'),
49+
('server unrescue', 'Restore server from rescue mode'),
50+
('server unset', 'Unset server properties'),
51+
('server unshelve', 'Unshelve server(s)')
52+
]
53+
54+
def test_server_commands_main_help(self):
55+
"""Check server commands in main help message."""
56+
raw_output = self.openstack('help')
57+
for command, description in self.SERVER_COMMANDS:
58+
self.assertIn(command, raw_output)
59+
self.assertIn(description, raw_output)
60+
61+
def test_server_only_help(self):
62+
"""Check list of server-related commands only."""
63+
raw_output = self.openstack('help server')
64+
for command in [row[0] for row in self.SERVER_COMMANDS]:
65+
self.assertIn(command, raw_output)

0 commit comments

Comments
 (0)