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