Updated docs.
[snaps.git] / docs / how-to-use / APITests.rst
1 SNAPS OpenStack API Testing
2 ===========================
3
4 Tests designated as component tests extend the snaps.openstack.tests.OSComponentTestCase class and must be exercised
5 with OpenStack credentials for all as well as an external network for many. When leveraging the unit\_test\_suite.py
6 application, the -e argument and -n arguments will suffice. When attempting to execute these tests within your IDE
7 of choice (tested on IntelliJ), you will need to edit the [repo\_dir]/snaps/openstack/tests/conf/os\_env.yaml file as well
8 as ensuring that your run configuration's working directory is set to [repo\_dir]/snaps.
9
10 The Test Classes
11 ================
12
13 glance_utils_tests.py - GlanceSmokeTests
14 ----------------------------------------
15
16 Ensures that a Glance client can be obtained as well as the proper
17 exceptions thrown with the wrong credentials.
18
19 keystone_utils_tests.py - KeystoneSmokeTests
20 --------------------------------------------
21
22 Ensures that a Keystone client can be obtained as well as the proper
23 exceptions thrown with the wrong credentials.
24
25 neutron_utils_tests.py - NeutronSmokeTests
26 ------------------------------------------
27
28 Ensures that a Neutron client can be obtained as well as the proper
29 exceptions thrown with the wrong credentials.
30
31 nova_utils_tests.py - NovaSmokeTests
32 ------------------------------------
33
34 Ensures that a Nova client can be obtained as well as the proper
35 exceptions thrown with the wrong credentials.
36
37 heat_utils_tests.py - HeatSmokeTests
38 ------------------------------------
39
40 Ensures that a Heat client can be obtained as well as the proper
41 exceptions thrown with the wrong credentials.
42
43 keystone_utils_tests.py - KeystoneUtilsTests
44 --------------------------------------------
45
46 +----------------------------------+---------------+-----------------------------------------------------------+
47 | Test Name                        | Keystone API  | Description                                               |
48 +==================================+===============+===========================================================+
49 | test_create_user_minimal         | 2 & 3         | Tests the creation of a user with minimal configuration   |
50 |                                  |               | settings via the utility functions                        |
51 +----------------------------------+---------------+-----------------------------------------------------------+
52 | test_create_project_minimal      | 2 & 3         | Tests the creation of a project with minimal configuration|
53 |                                  |               | settings via the utility functions                        |
54 +----------------------------------+---------------+-----------------------------------------------------------+
55 | test_get_endpoint_success        | 2 & 3         | Tests to ensure that proper credentials and proper service|
56 |                                  |               | type can succeed                                          |
57 +----------------------------------+---------------+-----------------------------------------------------------+
58 | test_get_endpoint_fail_without   | 2 & 3         | Tests to ensure that proper credentials and improper      |
59 | _proper_service                  |               | service type cannot succeed                               |
60 +----------------------------------+---------------+-----------------------------------------------------------+
61 | test_get_endpoint_fail_without   | 2 & 3         | Tests to ensure that improper credentials and proper      |
62 | _proper_credentials              |               | service type cannot succeed                               |
63 +----------------------------------+---------------+-----------------------------------------------------------+
64 | test_get_endpoint_with_each      | 2 & 3         | Tests to ensure that an interface URL is returned for each|
65 | _interface                       |               | supported interface type (i.e. public, internal, & admin) |
66 +----------------------------------+---------------+-----------------------------------------------------------+
67 | test_grant_user_role_to_project  | 2 & 3         | Tests to ensure that one can grant a new user's role to a |
68 |                                  |               | new project                                               |
69 +----------------------------------+---------------+-----------------------------------------------------------+
70
71 create_user_tests.py - CreateUserSuccessTests
72 ---------------------------------------------
73 +----------------------------------+---------------+-----------------------------------------------------------+
74 | Test Name                        | Keystone API  | Description                                               |
75 +==================================+===============+===========================================================+
76 | test_create_user                 | 2 & 3         | Tests the creation of a user with minimal configuration   |
77 |                                  |               | settings via the utility functions                        |
78 +----------------------------------+---------------+-----------------------------------------------------------+
79 | test_create_user_2x              | 2 & 3         | Tests the creation of a user 2x and ensure it has been    |
80 |                                  |               | done only once                                            |
81 +----------------------------------+---------------+-----------------------------------------------------------+
82 | test_create_delete_user          | 2 & 3         | Tests the creation of a user and ensure clean can be      |
83 |                                  |               | called 2x without exceptions being raised                 |
84 +----------------------------------+---------------+-----------------------------------------------------------+
85 | test_create_admin_user           | 2 & 3         | Tests the creation of a user with an 'admin' role         |
86 +----------------------------------+---------------+-----------------------------------------------------------+
87
88 create_project_tests.py - CreateProjectSuccessTests
89 ---------------------------------------------------
90
91 +----------------------------------+---------------+-----------------------------------------------------------+
92 | Test Name                        | Keystone API  | Description                                               |
93 +==================================+===============+===========================================================+
94 | test_create_project              | 2 & 3         | Tests the creation of a project via the OpenStackProject  |
95 |                                  |               | class                                                     |
96 +----------------------------------+---------------+-----------------------------------------------------------+
97 | test_create_project_2x           | 2 & 3         | Tests the creation of a project a second time via the     |
98 |                                  |               | OpenStackProject class to ensure it is only created once  |
99 +----------------------------------+---------------+-----------------------------------------------------------+
100 | test_create_delete_project       | 2 & 3         | Tests the creation and deletion of a project via the      |
101 |                                  |               | OpenStackProject class to ensure that clean will not raise|
102 |                                  |               | an exception                                              |
103 +----------------------------------+---------------+-----------------------------------------------------------+
104
105 create_project_tests.py - CreateProjectUserTests
106 ------------------------------------------------
107
108 +---------------------------------------+---------------+-----------------------------------------------------------+
109 | Test Name                             | Keystone API  | Description                                               |
110 +=======================================+===============+===========================================================+
111 | test_create_project_sec_grp_one_user  | 2 & 3         | Tests the creation of an OpenStack object to a project    |
112 |                                       |               | with a new users and to create a security group           |
113 |                                       |               |                                                           |
114 +---------------------------------------+---------------+-----------------------------------------------------------+
115 | test_create_project_sec_grp_two_users | 2 & 3         | Tests the creation of an OpenStack object to a project    |
116 |                                       |               | with two new users and to create a security group under   |
117 |                                       |               | each                                                      |
118 +---------------------------------------+---------------+-----------------------------------------------------------+
119
120 glance_utils_tests.py - GlanceUtilsTests
121 ----------------------------------------
122
123 +---------------------------------------+---------------+-----------------------------------------------------------+
124 | Test Name                             | Glance API    | Description                                               |
125 +=======================================+===============+===========================================================+
126 | test_create_image_minimal_url         | 1             | Tests the glance_utils.create_image() function with a URL |
127 +---------------------------------------+---------------+-----------------------------------------------------------+
128 | test_create_image_minimal_file        | 1             | Tests the glance_utils.create_image() function with a file|
129 +---------------------------------------+---------------+-----------------------------------------------------------+
130
131 neutron_utils_tests.py - NeutronUtilsNetworkTests
132 -------------------------------------------------
133
134 +---------------------------------------+---------------+-----------------------------------------------------------+
135 | Test Name                             | Neutron API   | Description                                               |
136 +=======================================+===============+===========================================================+
137 | test_create_network                   | 2             | Ensures neutron_utils.create_network() properly creates a |
138 |                                       |               | network                                                   |
139 +---------------------------------------+---------------+-----------------------------------------------------------+
140 | test_create_network_empty_name        | 2             | Ensures neutron_utils.create_network() raises an exception|
141 |                                       |               | when the network name is an empty string                  |
142 +---------------------------------------+---------------+-----------------------------------------------------------+
143 | test_create_network_null_name         | 2             | Ensures neutron_utils.create_network() raises an exception|
144 |                                       |               | when the network name is None                             |
145 +---------------------------------------+---------------+-----------------------------------------------------------+
146
147 neutron_utils_tests.py - NeutronUtilsSubnetTests
148 ------------------------------------------------
149
150 +---------------------------------------+---------------+-----------------------------------------------------------+
151 | Test Name                             | Neutron API   | Description                                               |
152 +=======================================+===============+===========================================================+
153 | test_create_subnet                    | 2             | Ensures neutron_utils.create_subnet() can properly create |
154 |                                       |               | an OpenStack subnet object                                |
155 +---------------------------------------+---------------+-----------------------------------------------------------+
156 | test_create_subnet_null_name          | 2             | Ensures neutron_utils.create_subnet() raises an exception |
157 |                                       |               | when the subnet name is None                              |
158 +---------------------------------------+---------------+-----------------------------------------------------------+
159 | test_create_subnet_empty_name         | 2             | Ensures neutron_utils.create_subnet() raises an exception |
160 |                                       |               | when the subnet name is an empty string                   |
161 +---------------------------------------+---------------+-----------------------------------------------------------+
162 | test_create_subnet_null_cidr          | 2             | Ensures neutron_utils.create_subnet() raises an exception |
163 |                                       |               | when the subnet CIDR is None                              |
164 +---------------------------------------+---------------+-----------------------------------------------------------+
165 | test_create_subnet_empty_cidr         | 2             | Ensures neutron_utils.create_subnet() raises an exception |
166 |                                       |               | when the subnet CIDR is an empty string                   |
167 +---------------------------------------+---------------+-----------------------------------------------------------+
168
169 neutron_utils_tests.py - NeutronUtilsRouterTests
170 ------------------------------------------------
171
172 +---------------------------------------+---------------+-----------------------------------------------------------+
173 | Test Name                             | Neutron API   | Description                                               |
174 +=======================================+===============+===========================================================+
175 | test_create_router_simple             | 2             | Ensures neutron_utils.create_router() can properly create |
176 |                                       |               | a simple OpenStack router object                          |
177 +---------------------------------------+---------------+-----------------------------------------------------------+
178 | test_create_router_with_public_inter  | 2             | Ensures neutron_utils.create_router() can properly create |
179 | face                                  |               | an OpenStack router object with an interface to the       |
180 |                                       |               | external network                                          |
181 +---------------------------------------+---------------+-----------------------------------------------------------+
182 | test_create_router_empty_name         | 2             | Ensures neutron_utils.create_router() raises an exception |
183 |                                       |               | when the name is an empty string                          |
184 +---------------------------------------+---------------+-----------------------------------------------------------+
185 | test_create_router_null_name          | 2             | Ensures neutron_utils.create_router() raises an exception |
186 |                                       |               | when the name is None                                     |
187 +---------------------------------------+---------------+-----------------------------------------------------------+
188 | test_add_interface_router             | 2             | Ensures neutron_utils.add_interface_router() properly adds|
189 |                                       |               | an interface to another subnet                            |
190 +---------------------------------------+---------------+-----------------------------------------------------------+
191 | test_add_interface_router_null_router | 2             | Ensures neutron_utils.add_interface_router() raises an    |
192 |                                       |               | exception when the router object is None                  |
193 +---------------------------------------+---------------+-----------------------------------------------------------+
194 | test_add_interface_router_null_subnet | 2             | Ensures neutron_utils.add_interface_router() raises an    |
195 |                                       |               | exception when the subnet object is None                  |
196 +---------------------------------------+---------------+-----------------------------------------------------------+
197 | test_create_port                      | 2             | Ensures neutron_utils.create_port() can properly create an|
198 |                                       |               | OpenStack port object                                     |
199 +---------------------------------------+---------------+-----------------------------------------------------------+
200 | test_create_port_empty_name           | 2             | Ensures neutron_utils.create_port() raises an exception   |
201 |                                       |               | when the port name is an empty string                     |
202 +---------------------------------------+---------------+-----------------------------------------------------------+
203 | test_create_port_null_name            | 2             | Ensures neutron_utils.create_port() raises an exception   |
204 |                                       |               | when the port name is None                                |
205 +---------------------------------------+---------------+-----------------------------------------------------------+
206 | test_create_port_null_network_object  | 2             | Ensures neutron_utils.create_port() raises an exception   |
207 |                                       |               | when the network object is None                           |
208 +---------------------------------------+---------------+-----------------------------------------------------------+
209 | test_create_port_null_ip              | 2             | Ensures neutron_utils.create_port() raises an exception   |
210 |                                       |               | when the assigned IP value is None                        |
211 +---------------------------------------+---------------+-----------------------------------------------------------+
212 | test_create_port_invalid_ip           | 2             | Ensures neutron_utils.create_port() raises an exception   |
213 |                                       |               | when the assigned IP value is invalid                     |
214 +---------------------------------------+---------------+-----------------------------------------------------------+
215 | test_create_port_invalid_ip_to_subnet | 2             | Ensures neutron_utils.create_port() raises an exception   |
216 |                                       |               | when the assigned IP value is not part of CIDR            |
217 +---------------------------------------+---------------+-----------------------------------------------------------+
218
219 neutron_utils_tests.py - NeutronUtilsSecurityGroupTests
220 -------------------------------------------------------
221
222 +---------------------------------------+---------------+-----------------------------------------------------------+
223 | Test Name                             | Neutron API   | Description                                               |
224 +=======================================+===============+===========================================================+
225 | test_create_delete_simple_sec_grp     | 2             | Ensures that a security group can be created              |
226 |                                       |               | (neutron_utils.create_security_group() and deleted via    |
227 |                                       |               | neutron_utils.delete_security_group()                     |
228 +---------------------------------------+---------------+-----------------------------------------------------------+
229 | test_create_sec_grp_no_name           | 2             | Ensures that neutron_utils.create_security_group() raises |
230 |                                       |               | an exception when attempting to create a security group   |
231 |                                       |               | without a name                                            |
232 +---------------------------------------+---------------+-----------------------------------------------------------+
233 | test_create_sec_grp_no_rules          | 2             | Ensures that neutron_utils.create_security_group() can    |
234 |                                       |               | create a security group without any rules                 |
235 +---------------------------------------+---------------+-----------------------------------------------------------+
236 | test_create_sec_grp_one_rule          | 2             | Ensures that neutron_utils.create_security_group_rule()   |
237 |                                       |               | can add a rule to a security group                        |
238 +---------------------------------------+---------------+-----------------------------------------------------------+
239 | test_get_sec_grp_by_id                | 2             | Ensures that neutron_utils.get_security_group_by_id()     |
240 |                                       |               | returns the expected security group                       |
241 +---------------------------------------+---------------+-----------------------------------------------------------+
242
243 neutron_utils_tests.py - NeutronUtilsFloatingIpTests
244 ----------------------------------------------------
245
246 +---------------------------------------+---------------+-----------------------------------------------------------+
247 | Test Name                             | Neutron API   | Description                                               |
248 +=======================================+===============+===========================================================+
249 | test_floating_ips                     | 2             | Ensures that a floating IP can be created                 |
250 +---------------------------------------+---------------+-----------------------------------------------------------+
251
252 nova_utils_tests.py - NovaUtilsKeypairTests
253 -------------------------------------------
254
255 +---------------------------------------+---------------+-----------------------------------------------------------+
256 | Test Name                             | Nova API      | Description                                               |
257 +=======================================+===============+===========================================================+
258 | test_create_keypair                   | 2             | Ensures that a keypair can be properly created via        |
259 |                                       |               | nova_utils.upload_keypair() with a public_key object      |
260 +---------------------------------------+---------------+-----------------------------------------------------------+
261 | test_create_delete_keypair            | 2             | Ensures that a keypair can be properly deleted via        |
262 |                                       |               | nova_utils.delete_keypair()                               |
263 +---------------------------------------+---------------+-----------------------------------------------------------+
264 | test_create_key_from_file             | 2             | Ensures that a keypair can be properly created via        |
265 |                                       |               | nova_utils.upload_keypair_file()                          |
266 +---------------------------------------+---------------+-----------------------------------------------------------+
267
268 nova_utils_tests.py - NovaUtilsFlavorTests
269 ------------------------------------------
270
271 +---------------------------------------+---------------+-----------------------------------------------------------+
272 | Test Name                             | Nova API      | Description                                               |
273 +=======================================+===============+===========================================================+
274 | test_create_flavor                    | 2             | Ensures that a flavor can be properly created via         |
275 |                                       |               | nova_utils.create_flavor()                                |
276 +---------------------------------------+---------------+-----------------------------------------------------------+
277 | test_create_delete_flavor             | 2             | Ensures that a flavor can be properly deleted via         |
278 |                                       |               | nova_utils.delete_flavor()                                |
279 +---------------------------------------+---------------+-----------------------------------------------------------+
280
281 nova_utils_tests.py - NovaUtilsInstanceTests
282 --------------------------------------------
283
284 +---------------------------------------+---------------+-----------------------------------------------------------+
285 | Test Name                             | Nova API      | Description                                               |
286 +=======================================+===============+===========================================================+
287 | test_create_instance                  | 2             | Ensures that a VM instance can be properly created via    |
288 |                                       |               | nova_utils.create_server()                                |
289 +---------------------------------------+---------------+-----------------------------------------------------------+
290
291 create_flavor_tests.py - CreateFlavorTests
292 ------------------------------------------
293
294 +---------------------------------------+---------------+-----------------------------------------------------------+
295 | Test Name                             | Nova API      | Description                                               |
296 +=======================================+===============+===========================================================+
297 | test_create_flavor                    | 2             | Ensures that the OpenStackFlavor class's create() method  |
298 |                                       |               | creates an OpenStack flavor object                        |
299 +---------------------------------------+---------------+-----------------------------------------------------------+
300 | test_create_flavor_existing           | 2             | Ensures that the OpenStackFlavor class's create() will not|
301 |                                       |               | create a flavor with the same name more than once         |
302 +---------------------------------------+---------------+-----------------------------------------------------------+
303 | test_create_clean_flavor              | 2             | Ensures that the OpenStackFlavor class's clean() method   |
304 |                                       |               | will delete the flavor object                             |
305 +---------------------------------------+---------------+-----------------------------------------------------------+
306 | test_create_delete_flavor             | 2             | Ensures that the OpenStackFlavor class's clean() method   |
307 |                                       |               | will not raise an exception when called and the object no |
308 |                                       |               | longer exists                                             |
309 +---------------------------------------+---------------+-----------------------------------------------------------+
310 | test_create_delete_flavor_all_settings| 2             | Ensures that the OpenStackFlavor class will create a      |
311 |                                       |               | a flavor properly with all supported settings             |
312 +---------------------------------------+---------------+-----------------------------------------------------------+
313
314 heat_utils_tests.py - HeatUtilsCreateStackTests
315 -----------------------------------------------
316
317 +---------------------------------------+---------------+-----------------------------------------------------------+
318 | Test Name                             | Glance API    | Description                                               |
319 +=======================================+===============+===========================================================+
320 | test_create_stack                     | 1             | Tests the heat_utils.create_stack() with a test template  |
321 +---------------------------------------+---------------+-----------------------------------------------------------+
322