Expanded project creation tests and validation.
[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_bad_domain   | 3             | Ensures that keystone v3 clients using the domain ID      |
95 |                                  |               | project setting project creation will fail with an invalid|
96 |                                  |               | domain id/name                                            |
97 +----------------------------------+---------------+-----------------------------------------------------------+
98 | test_create_project              | 2 & 3         | Tests the creation of a project via the OpenStackProject  |
99 |                                  |               | class                                                     |
100 +----------------------------------+---------------+-----------------------------------------------------------+
101 | test_create_project_2x           | 2 & 3         | Tests the creation of a project a second time via the     |
102 |                                  |               | OpenStackProject class to ensure it is only created once  |
103 +----------------------------------+---------------+-----------------------------------------------------------+
104 | test_create_delete_project       | 2 & 3         | Tests the creation and deletion of a project via the      |
105 |                                  |               | OpenStackProject class to ensure that clean will not raise|
106 |                                  |               | an exception                                              |
107 +----------------------------------+---------------+-----------------------------------------------------------+
108
109 create_project_tests.py - CreateProjectUserTests
110 ------------------------------------------------
111
112 +---------------------------------------+---------------+-----------------------------------------------------------+
113 | Test Name                             | Keystone API  | Description                                               |
114 +=======================================+===============+===========================================================+
115 | test_create_project_sec_grp_one_user  | 2 & 3         | Tests the creation of an OpenStack object to a project    |
116 |                                       |               | with a new users and to create a security group           |
117 |                                       |               |                                                           |
118 +---------------------------------------+---------------+-----------------------------------------------------------+
119 | test_create_project_sec_grp_two_users | 2 & 3         | Tests the creation of an OpenStack object to a project    |
120 |                                       |               | with two new users and to create a security group under   |
121 |                                       |               | each                                                      |
122 +---------------------------------------+---------------+-----------------------------------------------------------+
123
124 glance_utils_tests.py - GlanceUtilsTests
125 ----------------------------------------
126
127 +---------------------------------------+---------------+-----------------------------------------------------------+
128 | Test Name                             | Glance API    | Description                                               |
129 +=======================================+===============+===========================================================+
130 | test_create_image_minimal_url         | 1             | Tests the glance_utils.create_image() function with a URL |
131 +---------------------------------------+---------------+-----------------------------------------------------------+
132 | test_create_image_minimal_file        | 1             | Tests the glance_utils.create_image() function with a file|
133 +---------------------------------------+---------------+-----------------------------------------------------------+
134
135 neutron_utils_tests.py - NeutronUtilsNetworkTests
136 -------------------------------------------------
137
138 +---------------------------------------+---------------+-----------------------------------------------------------+
139 | Test Name                             | Neutron API   | Description                                               |
140 +=======================================+===============+===========================================================+
141 | test_create_network                   | 2             | Ensures neutron_utils.create_network() properly creates a |
142 |                                       |               | network                                                   |
143 +---------------------------------------+---------------+-----------------------------------------------------------+
144 | test_create_network_empty_name        | 2             | Ensures neutron_utils.create_network() raises an exception|
145 |                                       |               | when the network name is an empty string                  |
146 +---------------------------------------+---------------+-----------------------------------------------------------+
147 | test_create_network_null_name         | 2             | Ensures neutron_utils.create_network() raises an exception|
148 |                                       |               | when the network name is None                             |
149 +---------------------------------------+---------------+-----------------------------------------------------------+
150
151 neutron_utils_tests.py - NeutronUtilsSubnetTests
152 ------------------------------------------------
153
154 +---------------------------------------+---------------+-----------------------------------------------------------+
155 | Test Name                             | Neutron API   | Description                                               |
156 +=======================================+===============+===========================================================+
157 | test_create_subnet                    | 2             | Ensures neutron_utils.create_subnet() can properly create |
158 |                                       |               | an OpenStack subnet object                                |
159 +---------------------------------------+---------------+-----------------------------------------------------------+
160 | test_create_subnet_null_name          | 2             | Ensures neutron_utils.create_subnet() raises an exception |
161 |                                       |               | when the subnet name is None                              |
162 +---------------------------------------+---------------+-----------------------------------------------------------+
163 | test_create_subnet_empty_name         | 2             | Ensures neutron_utils.create_subnet() raises an exception |
164 |                                       |               | when the subnet name is an empty string                   |
165 +---------------------------------------+---------------+-----------------------------------------------------------+
166 | test_create_subnet_null_cidr          | 2             | Ensures neutron_utils.create_subnet() raises an exception |
167 |                                       |               | when the subnet CIDR is None                              |
168 +---------------------------------------+---------------+-----------------------------------------------------------+
169 | test_create_subnet_empty_cidr         | 2             | Ensures neutron_utils.create_subnet() raises an exception |
170 |                                       |               | when the subnet CIDR is an empty string                   |
171 +---------------------------------------+---------------+-----------------------------------------------------------+
172
173 neutron_utils_tests.py - NeutronUtilsRouterTests
174 ------------------------------------------------
175
176 +---------------------------------------+---------------+-----------------------------------------------------------+
177 | Test Name                             | Neutron API   | Description                                               |
178 +=======================================+===============+===========================================================+
179 | test_create_router_simple             | 2             | Ensures neutron_utils.create_router() can properly create |
180 |                                       |               | a simple OpenStack router object                          |
181 +---------------------------------------+---------------+-----------------------------------------------------------+
182 | test_create_router_with_public_inter  | 2             | Ensures neutron_utils.create_router() can properly create |
183 | face                                  |               | an OpenStack router object with an interface to the       |
184 |                                       |               | external network                                          |
185 +---------------------------------------+---------------+-----------------------------------------------------------+
186 | test_create_router_empty_name         | 2             | Ensures neutron_utils.create_router() raises an exception |
187 |                                       |               | when the name is an empty string                          |
188 +---------------------------------------+---------------+-----------------------------------------------------------+
189 | test_create_router_null_name          | 2             | Ensures neutron_utils.create_router() raises an exception |
190 |                                       |               | when the name is None                                     |
191 +---------------------------------------+---------------+-----------------------------------------------------------+
192 | test_add_interface_router             | 2             | Ensures neutron_utils.add_interface_router() properly adds|
193 |                                       |               | an interface to another subnet                            |
194 +---------------------------------------+---------------+-----------------------------------------------------------+
195 | test_add_interface_router_null_router | 2             | Ensures neutron_utils.add_interface_router() raises an    |
196 |                                       |               | exception when the router object is None                  |
197 +---------------------------------------+---------------+-----------------------------------------------------------+
198 | test_add_interface_router_null_subnet | 2             | Ensures neutron_utils.add_interface_router() raises an    |
199 |                                       |               | exception when the subnet object is None                  |
200 +---------------------------------------+---------------+-----------------------------------------------------------+
201 | test_create_port                      | 2             | Ensures neutron_utils.create_port() can properly create an|
202 |                                       |               | OpenStack port object                                     |
203 +---------------------------------------+---------------+-----------------------------------------------------------+
204 | test_create_port_empty_name           | 2             | Ensures neutron_utils.create_port() raises an exception   |
205 |                                       |               | when the port name is an empty string                     |
206 +---------------------------------------+---------------+-----------------------------------------------------------+
207 | test_create_port_null_name            | 2             | Ensures neutron_utils.create_port() raises an exception   |
208 |                                       |               | when the port name is None                                |
209 +---------------------------------------+---------------+-----------------------------------------------------------+
210 | test_create_port_null_network_object  | 2             | Ensures neutron_utils.create_port() raises an exception   |
211 |                                       |               | when the network object is None                           |
212 +---------------------------------------+---------------+-----------------------------------------------------------+
213 | test_create_port_null_ip              | 2             | Ensures neutron_utils.create_port() raises an exception   |
214 |                                       |               | when the assigned IP value is None                        |
215 +---------------------------------------+---------------+-----------------------------------------------------------+
216 | test_create_port_invalid_ip           | 2             | Ensures neutron_utils.create_port() raises an exception   |
217 |                                       |               | when the assigned IP value is invalid                     |
218 +---------------------------------------+---------------+-----------------------------------------------------------+
219 | test_create_port_invalid_ip_to_subnet | 2             | Ensures neutron_utils.create_port() raises an exception   |
220 |                                       |               | when the assigned IP value is not part of CIDR            |
221 +---------------------------------------+---------------+-----------------------------------------------------------+
222
223 neutron_utils_tests.py - NeutronUtilsSecurityGroupTests
224 -------------------------------------------------------
225
226 +---------------------------------------+---------------+-----------------------------------------------------------+
227 | Test Name                             | Neutron API   | Description                                               |
228 +=======================================+===============+===========================================================+
229 | test_create_delete_simple_sec_grp     | 2             | Ensures that a security group can be created              |
230 |                                       |               | (neutron_utils.create_security_group() and deleted via    |
231 |                                       |               | neutron_utils.delete_security_group()                     |
232 +---------------------------------------+---------------+-----------------------------------------------------------+
233 | test_create_sec_grp_no_name           | 2             | Ensures that neutron_utils.create_security_group() raises |
234 |                                       |               | an exception when attempting to create a security group   |
235 |                                       |               | without a name                                            |
236 +---------------------------------------+---------------+-----------------------------------------------------------+
237 | test_create_sec_grp_no_rules          | 2             | Ensures that neutron_utils.create_security_group() can    |
238 |                                       |               | create a security group without any rules                 |
239 +---------------------------------------+---------------+-----------------------------------------------------------+
240 | test_create_sec_grp_one_rule          | 2             | Ensures that neutron_utils.create_security_group_rule()   |
241 |                                       |               | can add a rule to a security group                        |
242 +---------------------------------------+---------------+-----------------------------------------------------------+
243 | test_get_sec_grp_by_id                | 2             | Ensures that neutron_utils.get_security_group_by_id()     |
244 |                                       |               | returns the expected security group                       |
245 +---------------------------------------+---------------+-----------------------------------------------------------+
246
247 neutron_utils_tests.py - NeutronUtilsFloatingIpTests
248 ----------------------------------------------------
249
250 +---------------------------------------+---------------+-----------------------------------------------------------+
251 | Test Name                             | Neutron API   | Description                                               |
252 +=======================================+===============+===========================================================+
253 | test_floating_ips                     | 2             | Ensures that a floating IP can be created                 |
254 +---------------------------------------+---------------+-----------------------------------------------------------+
255
256 nova_utils_tests.py - NovaUtilsKeypairTests
257 -------------------------------------------
258
259 +---------------------------------------+---------------+-----------------------------------------------------------+
260 | Test Name                             | Nova API      | Description                                               |
261 +=======================================+===============+===========================================================+
262 | test_create_keypair                   | 2             | Ensures that a keypair can be properly created via        |
263 |                                       |               | nova_utils.upload_keypair() with a public_key object      |
264 +---------------------------------------+---------------+-----------------------------------------------------------+
265 | test_create_delete_keypair            | 2             | Ensures that a keypair can be properly deleted via        |
266 |                                       |               | nova_utils.delete_keypair()                               |
267 +---------------------------------------+---------------+-----------------------------------------------------------+
268 | test_create_key_from_file             | 2             | Ensures that a keypair can be properly created via        |
269 |                                       |               | nova_utils.upload_keypair_file()                          |
270 +---------------------------------------+---------------+-----------------------------------------------------------+
271
272 nova_utils_tests.py - NovaUtilsFlavorTests
273 ------------------------------------------
274
275 +---------------------------------------+---------------+-----------------------------------------------------------+
276 | Test Name                             | Nova API      | Description                                               |
277 +=======================================+===============+===========================================================+
278 | test_create_flavor                    | 2             | Ensures that a flavor can be properly created via         |
279 |                                       |               | nova_utils.create_flavor()                                |
280 +---------------------------------------+---------------+-----------------------------------------------------------+
281 | test_create_delete_flavor             | 2             | Ensures that a flavor can be properly deleted via         |
282 |                                       |               | nova_utils.delete_flavor()                                |
283 +---------------------------------------+---------------+-----------------------------------------------------------+
284
285 nova_utils_tests.py - NovaUtilsInstanceTests
286 --------------------------------------------
287
288 +---------------------------------------+---------------+-----------------------------------------------------------+
289 | Test Name                             | Nova API      | Description                                               |
290 +=======================================+===============+===========================================================+
291 | test_create_instance                  | 2             | Ensures that a VM instance can be properly created via    |
292 |                                       |               | nova_utils.create_server()                                |
293 +---------------------------------------+---------------+-----------------------------------------------------------+
294
295 create_flavor_tests.py - CreateFlavorTests
296 ------------------------------------------
297
298 +---------------------------------------+---------------+-----------------------------------------------------------+
299 | Test Name                             | Nova API      | Description                                               |
300 +=======================================+===============+===========================================================+
301 | test_create_flavor                    | 2             | Ensures that the OpenStackFlavor class's create() method  |
302 |                                       |               | creates an OpenStack flavor object                        |
303 +---------------------------------------+---------------+-----------------------------------------------------------+
304 | test_create_flavor_existing           | 2             | Ensures that the OpenStackFlavor class's create() will not|
305 |                                       |               | create a flavor with the same name more than once         |
306 +---------------------------------------+---------------+-----------------------------------------------------------+
307 | test_create_clean_flavor              | 2             | Ensures that the OpenStackFlavor class's clean() method   |
308 |                                       |               | will delete the flavor object                             |
309 +---------------------------------------+---------------+-----------------------------------------------------------+
310 | test_create_delete_flavor             | 2             | Ensures that the OpenStackFlavor class's clean() method   |
311 |                                       |               | will not raise an exception when called and the object no |
312 |                                       |               | longer exists                                             |
313 +---------------------------------------+---------------+-----------------------------------------------------------+
314 | test_create_delete_flavor_all_settings| 2             | Ensures that the OpenStackFlavor class will create a      |
315 |                                       |               | a flavor properly with all supported settings             |
316 +---------------------------------------+---------------+-----------------------------------------------------------+
317
318 heat_utils_tests.py - HeatUtilsCreateStackTests
319 -----------------------------------------------
320
321 +---------------------------------------+---------------+-----------------------------------------------------------+
322 | Test Name                             | Glance API    | Description                                               |
323 +=======================================+===============+===========================================================+
324 | test_create_stack                     | 1             | Tests the heat_utils.create_stack() with a test template  |
325 +---------------------------------------+---------------+-----------------------------------------------------------+
326