blob: 43c3c45e3b4fd5098d66b22fd592ada96dc15a0f [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
Matthew Treinish90aedd12013-02-25 17:56:49 -050021from oslo.config import cfg
Joe Gordonc97f5c72013-02-14 01:15:57 +000022import testtools
23
24import cli
Matthew Treinish90aedd12013-02-25 17:56:49 -050025from tempest import config
Joe Gordonc97f5c72013-02-14 01:15:57 +000026
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')
Joe Gordon4edb6452013-03-05 21:18:59 +000059 self.nova('absolute-limits', params='--reserved')
Joe Gordon34dc84d2013-02-21 02:19:23 +000060
Joe Gordonc97f5c72013-02-14 01:15:57 +000061 def test_admin_aggregate_list(self):
62 self.nova('aggregate-list')
63
Joe Gordon34dc84d2013-02-21 02:19:23 +000064 def test_admin_availability_zone_list(self):
Joe Gordon4edb6452013-03-05 21:18:59 +000065 self.assertIn("internal", self.nova('availability-zone-list'))
Joe Gordon34dc84d2013-02-21 02:19:23 +000066
Joe Gordonc97f5c72013-02-14 01:15:57 +000067 def test_admin_cloudpipe_list(self):
68 self.nova('cloudpipe-list')
69
Joe Gordon34dc84d2013-02-21 02:19:23 +000070 def test_admin_credentials(self):
71 self.nova('credentials')
Joe Gordonc97f5c72013-02-14 01:15:57 +000072
73 def test_admin_dns_domains(self):
74 self.nova('dns-domains')
75
Matthew Treinishff40ee52013-03-19 14:52:37 -040076 @testtools.skip("Test needs parameters, Bug: 1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +000077 def test_admin_dns_list(self):
78 self.nova('dns-list')
79
80 def test_admin_endpoints(self):
81 self.nova('endpoints')
82
83 def test_admin_flavor_acces_list(self):
84 self.assertRaises(subprocess.CalledProcessError,
85 self.nova,
86 'flavor-access-list')
87 # Failed to get access list for public flavor type
88 self.assertRaises(subprocess.CalledProcessError,
89 self.nova,
90 'flavor-access-list',
91 params='--flavor m1.tiny')
92
Joe Gordonc97f5c72013-02-14 01:15:57 +000093 def test_admin_flavor_list(self):
Joe Gordon4edb6452013-03-05 21:18:59 +000094 self.assertIn("Memory_MB", self.nova('flavor-list'))
Joe Gordonc97f5c72013-02-14 01:15:57 +000095
Joe Gordon34dc84d2013-02-21 02:19:23 +000096 def test_admin_floating_ip_bulk_list(self):
97 self.nova('floating-ip-bulk-list')
98
99 def test_admin_floating_ip_list(self):
100 self.nova('floating-ip-list')
101
102 def test_admin_floating_ip_pool_list(self):
103 self.nova('floating-ip-pool-list')
104
105 def test_admin_host_list(self):
106 self.nova('host-list')
107
108 def test_admin_hypervisor_list(self):
109 self.nova('hypervisor-list')
110
111 def test_admin_image_list(self):
112 self.nova('image-list')
113
Matthew Treinishff40ee52013-03-19 14:52:37 -0400114 @testtools.skip("Test needs parameters, Bug: 1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000115 def test_admin_interface_list(self):
116 self.nova('interface-list')
117
118 def test_admin_keypair_list(self):
119 self.nova('keypair-list')
120
121 def test_admin_list(self):
122 self.nova('list')
123 self.nova('list', params='--all-tenants 1')
124 self.nova('list', params='--all-tenants 0')
125 self.assertRaises(subprocess.CalledProcessError,
126 self.nova,
127 'list',
128 params='--all-tenants bad')
129
130 def test_admin_network_list(self):
131 self.nova('network-list')
132
133 def test_admin_rate_limits(self):
134 self.nova('rate-limits')
135
136 def test_admin_secgroup_list(self):
137 self.nova('secgroup-list')
138
Matthew Treinishff40ee52013-03-19 14:52:37 -0400139 @testtools.skip("Test needs parameters, Bug: 1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000140 def test_admin_secgroup_list_rules(self):
141 self.nova('secgroup-list-rules')
142
143 def test_admin_servce_list(self):
144 self.nova('service-list')
145
146 def test_admin_usage(self):
147 self.nova('usage')
148
149 def test_admin_usage_list(self):
150 self.nova('usage-list')
151
152 def test_admin_volume_list(self):
153 self.nova('volume-list')
154
155 def test_admin_volume_snapshot_list(self):
156 self.nova('volume-snapshot-list')
157
158 def test_admin_volume_type_list(self):
159 self.nova('volume-type-list')
160
161 def test_admin_help(self):
162 self.nova('help')
163
164 def test_admin_list_extensions(self):
165 self.nova('list-extensions')
166
167 def test_admin_net_list(self):
168 self.nova('net-list')
169
170 # Optional arguments:
171
172 def test_admin_version(self):
173 self.nova('', flags='--version')
174
175 def test_admin_debug_list(self):
176 self.nova('list', flags='--debug')
177
178 def test_admin_timeout(self):
179 self.nova('list', flags='--timeout 2')
180
181 def test_admin_timing(self):
182 self.nova('list', flags='--timing')