blob: 849ed6fdc37c363d09db2d95d7fdadc18ee72629 [file] [log] [blame]
Joe Gordonc97f5c72013-02-14 01:15:57 +00001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2013 OpenStack Foundation
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18import logging
Joe Gordonc97f5c72013-02-14 01:15:57 +000019import subprocess
20
21import testtools
22
23import cli
24
Joe Gordonc97f5c72013-02-14 01:15:57 +000025from tempest.openstack.common import cfg
26
27
28CONF = cfg.CONF
29
30
31LOG = logging.getLogger(__name__)
32
33
Pavel Sedláka2b757c2013-02-25 18:16:04 +010034class SimpleReadOnlyNovaClientTest(cli.ClientTestBase):
Joe Gordonc97f5c72013-02-14 01:15:57 +000035
36 """
37 This is a first pass at a simple read only python-novaclient test. This
38 only exercises client commands that are read only.
39
40 This should test commands:
41 * as a regular user
42 * as a admin user
43 * with and without optional parameters
44 * initially just check return codes, and later test command outputs
45
46 """
47
Joe Gordonc97f5c72013-02-14 01:15:57 +000048 def test_admin_fake_action(self):
49 self.assertRaises(subprocess.CalledProcessError,
50 self.nova,
51 'this-does-nova-exist')
52
Joe Gordon34dc84d2013-02-21 02:19:23 +000053 #NOTE(jogo): Commands in order listed in 'nova help'
54
55 # Positional arguments:
56
57 def test_admin_absolute_limites(self):
58 self.nova('absolute-limits')
59
Joe Gordonc97f5c72013-02-14 01:15:57 +000060 def test_admin_aggregate_list(self):
61 self.nova('aggregate-list')
62
Joe Gordon34dc84d2013-02-21 02:19:23 +000063 def test_admin_availability_zone_list(self):
64 self.nova('availability-zone-list')
65
Joe Gordonc97f5c72013-02-14 01:15:57 +000066 def test_admin_cloudpipe_list(self):
67 self.nova('cloudpipe-list')
68
Joe Gordon34dc84d2013-02-21 02:19:23 +000069 def test_admin_credentials(self):
70 self.nova('credentials')
Joe Gordonc97f5c72013-02-14 01:15:57 +000071
72 def test_admin_dns_domains(self):
73 self.nova('dns-domains')
74
Joe Gordon34dc84d2013-02-21 02:19:23 +000075 @testtools.skip("needs parameters")
76 def test_admin_dns_list(self):
77 self.nova('dns-list')
78
79 def test_admin_endpoints(self):
80 self.nova('endpoints')
81
82 def test_admin_flavor_acces_list(self):
83 self.assertRaises(subprocess.CalledProcessError,
84 self.nova,
85 'flavor-access-list')
86 # Failed to get access list for public flavor type
87 self.assertRaises(subprocess.CalledProcessError,
88 self.nova,
89 'flavor-access-list',
90 params='--flavor m1.tiny')
91
Joe Gordonc97f5c72013-02-14 01:15:57 +000092 def test_admin_flavor_list(self):
93 self.nova('flavor-list')
94
Joe Gordon34dc84d2013-02-21 02:19:23 +000095 def test_admin_floating_ip_bulk_list(self):
96 self.nova('floating-ip-bulk-list')
97
98 def test_admin_floating_ip_list(self):
99 self.nova('floating-ip-list')
100
101 def test_admin_floating_ip_pool_list(self):
102 self.nova('floating-ip-pool-list')
103
104 def test_admin_host_list(self):
105 self.nova('host-list')
106
107 def test_admin_hypervisor_list(self):
108 self.nova('hypervisor-list')
109
110 def test_admin_image_list(self):
111 self.nova('image-list')
112
113 @testtools.skip("needs parameters")
114 def test_admin_interface_list(self):
115 self.nova('interface-list')
116
117 def test_admin_keypair_list(self):
118 self.nova('keypair-list')
119
120 def test_admin_list(self):
121 self.nova('list')
122 self.nova('list', params='--all-tenants 1')
123 self.nova('list', params='--all-tenants 0')
124 self.assertRaises(subprocess.CalledProcessError,
125 self.nova,
126 'list',
127 params='--all-tenants bad')
128
129 def test_admin_network_list(self):
130 self.nova('network-list')
131
132 def test_admin_rate_limits(self):
133 self.nova('rate-limits')
134
135 def test_admin_secgroup_list(self):
136 self.nova('secgroup-list')
137
138 @testtools.skip("needs parameters")
139 def test_admin_secgroup_list_rules(self):
140 self.nova('secgroup-list-rules')
141
142 def test_admin_servce_list(self):
143 self.nova('service-list')
144
145 def test_admin_usage(self):
146 self.nova('usage')
147
148 def test_admin_usage_list(self):
149 self.nova('usage-list')
150
151 def test_admin_volume_list(self):
152 self.nova('volume-list')
153
154 def test_admin_volume_snapshot_list(self):
155 self.nova('volume-snapshot-list')
156
157 def test_admin_volume_type_list(self):
158 self.nova('volume-type-list')
159
160 def test_admin_help(self):
161 self.nova('help')
162
163 def test_admin_list_extensions(self):
164 self.nova('list-extensions')
165
166 def test_admin_net_list(self):
167 self.nova('net-list')
168
169 # Optional arguments:
170
171 def test_admin_version(self):
172 self.nova('', flags='--version')
173
174 def test_admin_debug_list(self):
175 self.nova('list', flags='--debug')
176
177 def test_admin_timeout(self):
178 self.nova('list', flags='--timeout 2')
179
180 def test_admin_timing(self):
181 self.nova('list', flags='--timing')