Fixed RST warning.
[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 keystone_utils_tests.py - KeystoneUtilsTests
38 --------------------------------------------
39
40 +----------------------------------+---------------+-----------------------------------------------------------+
41 | Test Name                        | Keystone API  | Description                                               |
42 +==================================+===============+===========================================================+
43 | test_create_user_minimal         | 2 & 3         | Tests the creation of a user with minimal configuration   |
44 |                                  |               | settings via the utility functions                        |
45 +----------------------------------+---------------+-----------------------------------------------------------+
46 | test_create_project_minimal      | 2 & 3         | Tests the creation of a project with minimal configuration|
47 |                                  |               | settings via the utility functions                        |
48 +----------------------------------+---------------+-----------------------------------------------------------+
49 | test_get_endpoint_success        | 2 & 3         | Tests to ensure that proper credentials and proper service|
50 |                                  |               | type can succeed                                          |
51 +----------------------------------+---------------+-----------------------------------------------------------+
52 | test_get_endpoint_fail_without   | 2 & 3         | Tests to ensure that proper credentials and improper      |
53 | _proper_service                  |               | service type cannot succeed                               |
54 +----------------------------------+---------------+-----------------------------------------------------------+
55 | test_get_endpoint_fail_without   | 2 & 3         | Tests to ensure that improper credentials and proper      |
56 | _proper_credentials              |               | service type cannot succeed                               |
57 +----------------------------------+---------------+-----------------------------------------------------------+
58
59 create_user_tests.py - CreateUserSuccessTests
60 ---------------------------------------------
61 +----------------------------------+---------------+-----------------------------------------------------------+
62 | Test Name                        | Keystone API  | Description                                               |
63 +==================================+===============+===========================================================+
64 | test_create_user                 | 2 & 3         | Tests the creation of a user with minimal configuration   |
65 |                                  |               | settings via the utility functions                        |
66 +----------------------------------+---------------+-----------------------------------------------------------+
67
68 create_project_tests.py - CreateProjectSuccessTests
69 ---------------------------------------------------
70
71 +----------------------------------+---------------+-----------------------------------------------------------+
72 | Test Name                        | Keystone API  | Description                                               |
73 +==================================+===============+===========================================================+
74 | test_create_user_minimal         | 2 & 3         | Tests the creation of a user via the OpenStackUser class  |
75 +----------------------------------+---------------+-----------------------------------------------------------+
76 | test_create_user_2x              | 2 & 3         | Tests the creation of a user a second time via the        |
77 |                                  |               | OpenStackUser class to ensure it is only created once     |
78 +----------------------------------+---------------+-----------------------------------------------------------+
79 | test_create_delete_user          | 2 & 3         | Tests the creation and deletion of a user via the         |
80 |                                  |               | OpenStackUser class to ensure that clean will not raise   |
81 |                                  |               | an exception                                              |
82 +----------------------------------+---------------+-----------------------------------------------------------+
83
84 create_project_tests.py - CreateProjectUserTests
85 ------------------------------------------------
86
87 +---------------------------------------+---------------+-----------------------------------------------------------+
88 | Test Name                             | Keystone API  | Description                                               |
89 +=======================================+===============+===========================================================+
90 | test_create_project_sec_grp_one_user  | 2 & 3         | Tests the creation of an OpenStack object to a project    |
91 |                                       |               | with a new users and to create a security group           |
92 |                                       |               |                                                           |
93 +---------------------------------------+---------------+-----------------------------------------------------------+
94 | test_create_project_sec_grp_two_users | 2 & 3         | Tests the creation of an OpenStack object to a project    |
95 |                                       |               | with two new users and to create a security group under   |
96 |                                       |               | each                                                      |
97 +---------------------------------------+---------------+-----------------------------------------------------------+
98
99 glance_utils_tests.py - GlanceUtilsTests
100 ----------------------------------------
101
102 +---------------------------------------+---------------+-----------------------------------------------------------+
103 | Test Name                             | Glance API    | Description                                               |
104 +=======================================+===============+===========================================================+
105 | test_create_image_minimal_url         | 1             | Tests the glance_utils.create_image() function with a URL |
106 +---------------------------------------+---------------+-----------------------------------------------------------+
107 | test_create_image_minimal_file        | 1             | Tests the glance_utils.create_image() function with a file|
108 +---------------------------------------+---------------+-----------------------------------------------------------+
109
110 neutron_utils_tests.py - NeutronUtilsNetworkTests
111 -------------------------------------------------
112
113 +---------------------------------------+---------------+-----------------------------------------------------------+
114 | Test Name                             | Neutron API   | Description                                               |
115 +=======================================+===============+===========================================================+
116 | test_create_network                   | 2             | Ensures neutron_utils.create_network() properly creates a |
117 |                                       |               | network                                                   |
118 +---------------------------------------+---------------+-----------------------------------------------------------+
119 | test_create_network_empty_name        | 2             | Ensures neutron_utils.create_network() raises an exception|
120 |                                       |               | when the network name is an empty string                  |
121 +---------------------------------------+---------------+-----------------------------------------------------------+
122 | test_create_network_null_name         | 2             | Ensures neutron_utils.create_network() raises an exception|
123 |                                       |               | when the network name is None                             |
124 +---------------------------------------+---------------+-----------------------------------------------------------+
125
126 neutron_utils_tests.py - NeutronUtilsSubnetTests
127 ------------------------------------------------
128
129 +---------------------------------------+---------------+-----------------------------------------------------------+
130 | Test Name                             | Neutron API   | Description                                               |
131 +=======================================+===============+===========================================================+
132 | test_create_subnet                    | 2             | Ensures neutron_utils.create_subnet() can properly create |
133 |                                       |               | an OpenStack subnet object                                |
134 +---------------------------------------+---------------+-----------------------------------------------------------+
135 | test_create_subnet_null_name          | 2             | Ensures neutron_utils.create_subnet() raises an exception |
136 |                                       |               | when the subnet name is None                              |
137 +---------------------------------------+---------------+-----------------------------------------------------------+
138 | test_create_subnet_empty_name         | 2             | Ensures neutron_utils.create_subnet() raises an exception |
139 |                                       |               | when the subnet name is an empty string                   |
140 +---------------------------------------+---------------+-----------------------------------------------------------+
141 | test_create_subnet_null_cidr          | 2             | Ensures neutron_utils.create_subnet() raises an exception |
142 |                                       |               | when the subnet CIDR is None                              |
143 +---------------------------------------+---------------+-----------------------------------------------------------+
144 | test_create_subnet_empty_cidr         | 2             | Ensures neutron_utils.create_subnet() raises an exception |
145 |                                       |               | when the subnet CIDR is an empty string                   |
146 +---------------------------------------+---------------+-----------------------------------------------------------+
147
148 neutron_utils_tests.py - NeutronUtilsRouterTests
149 ------------------------------------------------
150
151 +---------------------------------------+---------------+-----------------------------------------------------------+
152 | Test Name                             | Neutron API   | Description                                               |
153 +=======================================+===============+===========================================================+
154 | test_create_router_simple             | 2             | Ensures neutron_utils.create_router() can properly create |
155 |                                       |               | a simple OpenStack router object                          |
156 +---------------------------------------+---------------+-----------------------------------------------------------+
157 | test_create_router_with_public_inter  | 2             | Ensures neutron_utils.create_router() can properly create |
158 | face                                  |               | an OpenStack router object with an interface to the       |
159 |                                       |               | external network                                          |
160 +---------------------------------------+---------------+-----------------------------------------------------------+
161 | test_create_router_empty_name         | 2             | Ensures neutron_utils.create_router() raises an exception |
162 |                                       |               | when the name is an empty string                          |
163 +---------------------------------------+---------------+-----------------------------------------------------------+
164 | test_create_router_null_name          | 2             | Ensures neutron_utils.create_router() raises an exception |
165 |                                       |               | when the name is None                                     |
166 +---------------------------------------+---------------+-----------------------------------------------------------+
167 | test_add_interface_router             | 2             | Ensures neutron_utils.add_interface_router() properly adds|
168 |                                       |               | an interface to another subnet                            |
169 +---------------------------------------+---------------+-----------------------------------------------------------+
170 | test_add_interface_router_null_router | 2             | Ensures neutron_utils.add_interface_router() raises an    |
171 |                                       |               | exception when the router object is None                  |
172 +---------------------------------------+---------------+-----------------------------------------------------------+
173 | test_add_interface_router_null_subnet | 2             | Ensures neutron_utils.add_interface_router() raises an    |
174 |                                       |               | exception when the subnet object is None                  |
175 +---------------------------------------+---------------+-----------------------------------------------------------+
176 | test_create_port                      | 2             | Ensures neutron_utils.create_port() can properly create an|
177 |                                       |               | OpenStack port object                                     |
178 +---------------------------------------+---------------+-----------------------------------------------------------+
179 | test_create_port_empty_name           | 2             | Ensures neutron_utils.create_port() raises an exception   |
180 |                                       |               | when the port name is an empty string                     |
181 +---------------------------------------+---------------+-----------------------------------------------------------+
182 | test_create_port_null_name            | 2             | Ensures neutron_utils.create_port() raises an exception   |
183 |                                       |               | when the port name is None                                |
184 +---------------------------------------+---------------+-----------------------------------------------------------+
185 | test_create_port_null_network_object  | 2             | Ensures neutron_utils.create_port() raises an exception   |
186 |                                       |               | when the network object is None                           |
187 +---------------------------------------+---------------+-----------------------------------------------------------+
188 | test_create_port_null_ip              | 2             | Ensures neutron_utils.create_port() raises an exception   |
189 |                                       |               | when the assigned IP value is None                        |
190 +---------------------------------------+---------------+-----------------------------------------------------------+
191 | test_create_port_invalid_ip           | 2             | Ensures neutron_utils.create_port() raises an exception   |
192 |                                       |               | when the assigned IP value is invalid                     |
193 +---------------------------------------+---------------+-----------------------------------------------------------+
194 | test_create_port_invalid_ip_to_subnet | 2             | Ensures neutron_utils.create_port() raises an exception   |
195 |                                       |               | when the assigned IP value is not part of CIDR            |
196 +---------------------------------------+---------------+-----------------------------------------------------------+
197
198 neutron_utils_tests.py - NeutronUtilsSecurityGroupTests
199 -------------------------------------------------------
200
201 +---------------------------------------+---------------+-----------------------------------------------------------+
202 | Test Name                             | Neutron API   | Description                                               |
203 +=======================================+===============+===========================================================+
204 | test_create_delete_simple_sec_grp     | 2             | Ensures that a security group can be created              |
205 |                                       |               | (neutron_utils.create_security_group() and deleted via    |
206 |                                       |               | neutron_utils.delete_security_group()                     |
207 +---------------------------------------+---------------+-----------------------------------------------------------+
208 | test_create_sec_grp_no_name           | 2             | Ensures that neutron_utils.create_security_group() raises |
209 |                                       |               | an exception when attempting to create a security group   |
210 |                                       |               | without a name                                            |
211 +---------------------------------------+---------------+-----------------------------------------------------------+
212 | test_create_sec_grp_no_rules          | 2             | Ensures that neutron_utils.create_security_group() can    |
213 |                                       |               | create a security group without any rules                 |
214 +---------------------------------------+---------------+-----------------------------------------------------------+
215 | test_create_sec_grp_one_rule          | 2             | Ensures that neutron_utils.create_security_group_rule()   |
216 |                                       |               | can add a rule to a security group                        |
217 +---------------------------------------+---------------+-----------------------------------------------------------+
218
219 nova_utils_tests.py - NovaUtilsKeypairTests
220 -------------------------------------------
221
222 +---------------------------------------+---------------+-----------------------------------------------------------+
223 | Test Name                             | Nova API      | Description                                               |
224 +=======================================+===============+===========================================================+
225 | test_create_keypair                   | 2             | Ensures that a keypair can be properly created via        |
226 |                                       |               | nova_utils.upload_keypair() with a public_key object      |
227 +---------------------------------------+---------------+-----------------------------------------------------------+
228 | test_create_delete_keypair            | 2             | Ensures that a keypair can be properly deleted via        |
229 |                                       |               | nova_utils.delete_keypair()                               |
230 +---------------------------------------+---------------+-----------------------------------------------------------+
231 | test_create_key_from_file             | 2             | Ensures that a keypair can be properly created via        |
232 |                                       |               | nova_utils.upload_keypair_file()                          |
233 +---------------------------------------+---------------+-----------------------------------------------------------+
234 | test_floating_ips                     | 2             | Ensures that a floating IP can be properly created via    |
235 |                                       |               | nova_utils.create_floating_ip() [note: this test should   |
236 |                                       |               | be moved to a new class]                                  |
237 +---------------------------------------+---------------+-----------------------------------------------------------+
238
239 nova_utils_tests.py - NovaUtilsFlavorTests
240 ------------------------------------------
241
242 +---------------------------------------+---------------+-----------------------------------------------------------+
243 | Test Name                             | Nova API      | Description                                               |
244 +=======================================+===============+===========================================================+
245 | test_create_flavor                    | 2             | Ensures that a flavor can be properly created via         |
246 |                                       |               | nova_utils.create_flavor()                                |
247 +---------------------------------------+---------------+-----------------------------------------------------------+
248 | test_create_delete_flavor             | 2             | Ensures that a flavor can be properly deleted via         |
249 |                                       |               | nova_utils.delete_flavor()                                |
250 +---------------------------------------+---------------+-----------------------------------------------------------+
251
252 create_flavor_tests.py - CreateFlavorTests
253 ------------------------------------------
254
255 +---------------------------------------+---------------+-----------------------------------------------------------+
256 | Test Name                             | Nova API      | Description                                               |
257 +=======================================+===============+===========================================================+
258 | test_create_flavor                    | 2             | Ensures that the OpenStackFlavor class's create() method  |
259 |                                       |               | creates an OpenStack flavor object                        |
260 +---------------------------------------+---------------+-----------------------------------------------------------+
261 | test_create_flavor_existing           | 2             | Ensures that the OpenStackFlavor class's create() will not|
262 |                                       |               | create a flavor with the same name more than once         |
263 +---------------------------------------+---------------+-----------------------------------------------------------+
264 | test_create_clean_flavor              | 2             | Ensures that the OpenStackFlavor class's clean() method   |
265 |                                       |               | will delete the flavor object                             |
266 +---------------------------------------+---------------+-----------------------------------------------------------+
267 | test_create_delete_flavor             | 2             | Ensures that the OpenStackFlavor class's clean() method   |
268 |                                       |               | will not raise an exception when called and the object no |
269 |                                       |               | longer exists                                             |
270 +---------------------------------------+---------------+-----------------------------------------------------------+