python-openstackclient 8.1.0__py3-none-any.whl → 8.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openstackclient/api/compute_v2.py +2 -2
- openstackclient/api/object_store_v1.py +4 -1
- openstackclient/api/volume_v2.py +60 -0
- openstackclient/api/volume_v3.py +60 -0
- openstackclient/command.py +27 -0
- openstackclient/common/availability_zone.py +1 -1
- openstackclient/common/clientmanager.py +59 -21
- openstackclient/common/configuration.py +1 -1
- openstackclient/common/extension.py +1 -1
- openstackclient/common/limits.py +1 -1
- openstackclient/common/module.py +4 -2
- openstackclient/common/project_cleanup.py +10 -8
- openstackclient/common/quota.py +23 -6
- openstackclient/common/versions.py +1 -2
- openstackclient/compute/v2/agent.py +1 -1
- openstackclient/compute/v2/aggregate.py +6 -5
- openstackclient/compute/v2/console.py +5 -3
- openstackclient/compute/v2/console_connection.py +1 -1
- openstackclient/compute/v2/flavor.py +15 -2
- openstackclient/compute/v2/host.py +1 -1
- openstackclient/compute/v2/hypervisor.py +1 -1
- openstackclient/compute/v2/hypervisor_stats.py +1 -1
- openstackclient/compute/v2/keypair.py +1 -1
- openstackclient/compute/v2/server.py +77 -30
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_event.py +1 -1
- openstackclient/compute/v2/server_group.py +4 -2
- openstackclient/compute/v2/server_image.py +1 -1
- openstackclient/compute/v2/server_migration.py +1 -1
- openstackclient/compute/v2/server_volume.py +1 -1
- openstackclient/compute/v2/service.py +1 -1
- openstackclient/compute/v2/usage.py +6 -4
- openstackclient/identity/common.py +10 -14
- openstackclient/identity/v2_0/catalog.py +3 -2
- openstackclient/identity/v2_0/ec2creds.py +1 -1
- openstackclient/identity/v2_0/endpoint.py +1 -1
- openstackclient/identity/v2_0/project.py +17 -7
- openstackclient/identity/v2_0/role.py +1 -1
- openstackclient/identity/v2_0/role_assignment.py +3 -3
- openstackclient/identity/v2_0/service.py +1 -1
- openstackclient/identity/v2_0/token.py +1 -1
- openstackclient/identity/v2_0/user.py +2 -2
- openstackclient/identity/v3/access_rule.py +16 -4
- openstackclient/identity/v3/application_credential.py +116 -95
- openstackclient/identity/v3/catalog.py +3 -3
- openstackclient/identity/v3/consumer.py +1 -1
- openstackclient/identity/v3/credential.py +1 -1
- openstackclient/identity/v3/domain.py +15 -10
- openstackclient/identity/v3/ec2creds.py +1 -1
- openstackclient/identity/v3/endpoint.py +33 -12
- openstackclient/identity/v3/endpoint_group.py +1 -1
- openstackclient/identity/v3/federation_protocol.py +1 -1
- openstackclient/identity/v3/group.py +11 -5
- openstackclient/identity/v3/identity_provider.py +12 -10
- openstackclient/identity/v3/implied_role.py +1 -1
- openstackclient/identity/v3/limit.py +1 -1
- openstackclient/identity/v3/mapping.py +1 -1
- openstackclient/identity/v3/policy.py +1 -1
- openstackclient/identity/v3/project.py +34 -22
- openstackclient/identity/v3/region.py +1 -1
- openstackclient/identity/v3/registered_limit.py +16 -11
- openstackclient/identity/v3/role.py +27 -41
- openstackclient/identity/v3/role_assignment.py +12 -23
- openstackclient/identity/v3/service.py +1 -1
- openstackclient/identity/v3/service_provider.py +1 -1
- openstackclient/identity/v3/tag.py +3 -2
- openstackclient/identity/v3/token.py +3 -2
- openstackclient/identity/v3/trust.py +4 -2
- openstackclient/identity/v3/unscoped_saml.py +1 -1
- openstackclient/identity/v3/user.py +22 -13
- openstackclient/image/v1/image.py +35 -17
- openstackclient/image/v2/cache.py +11 -7
- openstackclient/image/v2/image.py +62 -12
- openstackclient/image/v2/info.py +1 -1
- openstackclient/image/v2/metadef_namespaces.py +1 -1
- openstackclient/image/v2/metadef_objects.py +9 -3
- openstackclient/image/v2/metadef_properties.py +11 -3
- openstackclient/image/v2/metadef_resource_type_association.py +1 -1
- openstackclient/image/v2/metadef_resource_types.py +1 -1
- openstackclient/image/v2/task.py +1 -1
- openstackclient/network/common.py +10 -9
- openstackclient/network/v2/address_group.py +4 -3
- openstackclient/network/v2/address_scope.py +8 -6
- openstackclient/network/v2/default_security_group_rule.py +9 -8
- openstackclient/network/v2/floating_ip.py +16 -9
- openstackclient/network/v2/floating_ip_port_forwarding.py +9 -6
- openstackclient/network/v2/ip_availability.py +7 -4
- openstackclient/network/v2/l3_conntrack_helper.py +11 -4
- openstackclient/network/v2/local_ip.py +13 -7
- openstackclient/network/v2/local_ip_association.py +7 -4
- openstackclient/network/v2/ndp_proxy.py +13 -6
- openstackclient/network/v2/network.py +33 -16
- openstackclient/network/v2/network_agent.py +5 -5
- openstackclient/network/v2/network_auto_allocated_topology.py +1 -1
- openstackclient/network/v2/network_flavor.py +1 -1
- openstackclient/network/v2/network_flavor_profile.py +1 -1
- openstackclient/network/v2/network_meter.py +1 -1
- openstackclient/network/v2/network_meter_rule.py +1 -1
- openstackclient/network/v2/network_qos_policy.py +7 -5
- openstackclient/network/v2/network_qos_rule.py +1 -1
- openstackclient/network/v2/network_qos_rule_type.py +1 -1
- openstackclient/network/v2/network_rbac.py +8 -5
- openstackclient/network/v2/network_segment.py +2 -2
- openstackclient/network/v2/network_segment_range.py +13 -6
- openstackclient/network/v2/network_service_provider.py +1 -1
- openstackclient/network/v2/network_trunk.py +65 -42
- openstackclient/network/v2/port.py +38 -20
- openstackclient/network/v2/router.py +19 -8
- openstackclient/network/v2/security_group.py +52 -7
- openstackclient/network/v2/security_group_rule.py +27 -4
- openstackclient/network/v2/subnet.py +17 -18
- openstackclient/network/v2/subnet_pool.py +11 -9
- openstackclient/network/v2/taas/__init__.py +0 -0
- openstackclient/network/v2/taas/tap_flow.py +245 -0
- openstackclient/network/v2/taas/tap_mirror.py +237 -0
- openstackclient/network/v2/taas/tap_service.py +211 -0
- openstackclient/object/v1/account.py +1 -1
- openstackclient/object/v1/container.py +1 -1
- openstackclient/object/v1/object.py +1 -1
- openstackclient/shell.py +18 -8
- openstackclient/tests/functional/identity/v3/test_access_rule.py +1 -1
- openstackclient/tests/functional/identity/v3/test_application_credential.py +7 -7
- openstackclient/tests/functional/identity/v3/test_catalog.py +42 -23
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +174 -0
- openstackclient/tests/functional/image/v2/test_cache.py +54 -0
- openstackclient/tests/functional/image/v2/test_image.py +36 -14
- openstackclient/tests/functional/image/v2/test_metadef_resource_type.py +55 -0
- openstackclient/tests/functional/volume/v2/test_volume.py +1 -1
- openstackclient/tests/functional/volume/v3/test_volume.py +2 -2
- openstackclient/tests/unit/api/test_volume_v2.py +124 -0
- openstackclient/tests/unit/api/test_volume_v3.py +124 -0
- openstackclient/tests/unit/common/test_command.py +1 -1
- openstackclient/tests/unit/common/test_extension.py +2 -3
- openstackclient/tests/unit/common/test_module.py +14 -7
- openstackclient/tests/unit/common/test_quota.py +20 -0
- openstackclient/tests/unit/compute/v2/test_aggregate.py +5 -3
- openstackclient/tests/unit/compute/v2/test_console.py +1 -4
- openstackclient/tests/unit/compute/v2/test_flavor.py +160 -177
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -9
- openstackclient/tests/unit/compute/v2/test_server.py +406 -81
- openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -3
- openstackclient/tests/unit/compute/v2/test_service.py +1 -3
- openstackclient/tests/unit/fakes.py +35 -134
- openstackclient/tests/unit/identity/test_common.py +100 -0
- openstackclient/tests/unit/identity/v2_0/test_project.py +4 -4
- openstackclient/tests/unit/identity/v3/fakes.py +10 -2
- openstackclient/tests/unit/identity/v3/test_application_credential.py +50 -44
- openstackclient/tests/unit/identity/v3/test_domain.py +3 -3
- openstackclient/tests/unit/identity/v3/test_endpoint.py +1 -1
- openstackclient/tests/unit/identity/v3/test_group.py +4 -2
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +10 -10
- openstackclient/tests/unit/identity/v3/test_oauth.py +1 -1
- openstackclient/tests/unit/identity/v3/test_project.py +31 -54
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +2 -2
- openstackclient/tests/unit/identity/v3/test_role.py +3 -90
- openstackclient/tests/unit/identity/v3/test_user.py +7 -51
- openstackclient/tests/unit/image/v1/test_image.py +47 -0
- openstackclient/tests/unit/image/v2/test_image.py +190 -9
- openstackclient/tests/unit/image/v2/test_metadef_objects.py +22 -0
- openstackclient/tests/unit/image/v2/test_metadef_properties.py +24 -10
- openstackclient/tests/unit/network/test_common.py +9 -13
- openstackclient/tests/unit/network/v2/fakes.py +1 -0
- openstackclient/tests/unit/network/v2/taas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_flow.py +276 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_mirror.py +288 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_service.py +271 -0
- openstackclient/tests/unit/network/v2/test_address_group.py +19 -22
- openstackclient/tests/unit/network/v2/test_address_scope.py +10 -15
- openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +38 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +21 -27
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +21 -18
- openstackclient/tests/unit/network/v2/test_ip_availability.py +6 -8
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +6 -15
- openstackclient/tests/unit/network/v2/test_local_ip.py +12 -23
- openstackclient/tests/unit/network/v2/test_local_ip_association.py +13 -18
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +13 -23
- openstackclient/tests/unit/network/v2/test_network.py +41 -37
- openstackclient/tests/unit/network/v2/test_network_agent.py +13 -20
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +5 -8
- openstackclient/tests/unit/network/v2/test_network_flavor.py +14 -26
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +14 -17
- openstackclient/tests/unit/network/v2/test_network_meter.py +7 -17
- openstackclient/tests/unit/network/v2/test_network_meter_rule.py +10 -20
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +7 -13
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +44 -54
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +2 -7
- openstackclient/tests/unit/network/v2/test_network_rbac.py +21 -36
- openstackclient/tests/unit/network/v2/test_network_segment.py +13 -29
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +20 -19
- openstackclient/tests/unit/network/v2/test_network_service_provider.py +1 -4
- openstackclient/tests/unit/network/v2/test_network_trunk.py +52 -47
- openstackclient/tests/unit/network/v2/test_port.py +113 -84
- openstackclient/tests/unit/network/v2/test_router.py +104 -126
- openstackclient/tests/unit/network/v2/test_security_group_network.py +25 -26
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +66 -18
- openstackclient/tests/unit/network/v2/test_subnet.py +35 -46
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +21 -33
- openstackclient/tests/unit/volume/test_find_resource.py +4 -13
- openstackclient/tests/unit/volume/v2/test_volume.py +358 -305
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +3 -1
- openstackclient/tests/unit/volume/v3/test_volume.py +443 -415
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +9 -0
- openstackclient/volume/client.py +7 -17
- openstackclient/volume/v2/backup_record.py +1 -1
- openstackclient/volume/v2/consistency_group.py +1 -1
- openstackclient/volume/v2/consistency_group_snapshot.py +1 -1
- openstackclient/volume/v2/qos_specs.py +1 -1
- openstackclient/volume/v2/service.py +2 -2
- openstackclient/volume/v2/volume.py +80 -54
- openstackclient/volume/v2/volume_backend.py +1 -1
- openstackclient/volume/v2/volume_backup.py +5 -3
- openstackclient/volume/v2/volume_host.py +1 -2
- openstackclient/volume/v2/volume_snapshot.py +2 -2
- openstackclient/volume/v2/volume_transfer_request.py +1 -1
- openstackclient/volume/v2/volume_type.py +11 -6
- openstackclient/volume/v3/block_storage_cleanup.py +1 -1
- openstackclient/volume/v3/block_storage_cluster.py +1 -1
- openstackclient/volume/v3/block_storage_log_level.py +1 -1
- openstackclient/volume/v3/block_storage_manage.py +1 -1
- openstackclient/volume/v3/block_storage_resource_filter.py +1 -1
- openstackclient/volume/v3/service.py +2 -2
- openstackclient/volume/v3/volume.py +104 -77
- openstackclient/volume/v3/volume_attachment.py +6 -5
- openstackclient/volume/v3/volume_backup.py +18 -3
- openstackclient/volume/v3/volume_group.py +2 -2
- openstackclient/volume/v3/volume_group_snapshot.py +1 -1
- openstackclient/volume/v3/volume_group_type.py +1 -1
- openstackclient/volume/v3/volume_message.py +1 -1
- openstackclient/volume/v3/volume_snapshot.py +2 -2
- openstackclient/volume/v3/volume_transfer_request.py +1 -1
- openstackclient/volume/v3/volume_type.py +15 -9
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/METADATA +19 -17
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/RECORD +239 -224
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/entry_points.txt +15 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info/licenses}/AUTHORS +15 -0
- python_openstackclient-8.3.0.dist-info/pbr.json +1 -0
- openstackclient/tests/unit/common/test_logs.py +0 -221
- python_openstackclient-8.1.0.dist-info/pbr.json +0 -1
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info/licenses}/LICENSE +0 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.3.0.dist-info}/top_level.txt +0 -0
|
@@ -218,17 +218,39 @@ class ImageTests(base.BaseImageTests):
|
|
|
218
218
|
'image remove project ' + self.name + ' ' + my_project_id
|
|
219
219
|
)
|
|
220
220
|
|
|
221
|
-
|
|
222
|
-
#
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
#
|
|
233
|
-
|
|
234
|
-
|
|
221
|
+
def test_image_hidden(self):
|
|
222
|
+
# Test image is shown in list
|
|
223
|
+
output = self.openstack(
|
|
224
|
+
'image list',
|
|
225
|
+
parse_output=True,
|
|
226
|
+
)
|
|
227
|
+
self.assertIn(
|
|
228
|
+
self.name,
|
|
229
|
+
[img['Name'] for img in output],
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
# Hide the image and test image not show in the list
|
|
233
|
+
self.openstack('image set ' + '--hidden ' + self.name)
|
|
234
|
+
output = self.openstack(
|
|
235
|
+
'image list',
|
|
236
|
+
parse_output=True,
|
|
237
|
+
)
|
|
238
|
+
self.assertNotIn(self.name, [img['Name'] for img in output])
|
|
239
|
+
|
|
240
|
+
# Test image show in the list with flag
|
|
241
|
+
output = self.openstack(
|
|
242
|
+
'image list',
|
|
243
|
+
parse_output=True,
|
|
244
|
+
)
|
|
245
|
+
self.assertNotIn(self.name, [img['Name'] for img in output])
|
|
246
|
+
|
|
247
|
+
# Unhide the image and test image is again visible in regular list
|
|
248
|
+
self.openstack('image set ' + '--unhidden ' + self.name)
|
|
249
|
+
output = self.openstack(
|
|
250
|
+
'image list',
|
|
251
|
+
parse_output=True,
|
|
252
|
+
)
|
|
253
|
+
self.assertIn(
|
|
254
|
+
self.name,
|
|
255
|
+
[img['Name'] for img in output],
|
|
256
|
+
)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
2
|
+
# not use this file except in compliance with the License. You may obtain
|
|
3
|
+
# a copy of the License at
|
|
4
|
+
#
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
#
|
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
9
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
|
+
# License for the specific language governing permissions and limitations
|
|
11
|
+
# under the License.
|
|
12
|
+
|
|
13
|
+
import uuid
|
|
14
|
+
|
|
15
|
+
from openstackclient.tests.functional.image import base
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ImageMetadefResourceTypeTests(base.BaseImageTests):
|
|
19
|
+
"""Functional tests for image metadef resource type commands."""
|
|
20
|
+
|
|
21
|
+
def setUp(self):
|
|
22
|
+
super().setUp()
|
|
23
|
+
|
|
24
|
+
# Create unique namespace name using UUID
|
|
25
|
+
self.namespace_name = 'test-mdef-ns-' + uuid.uuid4().hex
|
|
26
|
+
self.resource_type_name = 'test-mdef-rt-' + uuid.uuid4().hex
|
|
27
|
+
|
|
28
|
+
# Create namespace
|
|
29
|
+
self.openstack('image metadef namespace create ' + self.namespace_name)
|
|
30
|
+
self.addCleanup(
|
|
31
|
+
self.openstack,
|
|
32
|
+
'image metadef namespace delete ' + self.namespace_name,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
def test_metadef_resource_type(self):
|
|
36
|
+
"""Test image metadef resource type commands"""
|
|
37
|
+
|
|
38
|
+
self.openstack(
|
|
39
|
+
'image metadef resource type association create '
|
|
40
|
+
f'{self.namespace_name} {self.resource_type_name}',
|
|
41
|
+
)
|
|
42
|
+
self.addCleanup(
|
|
43
|
+
self.openstack,
|
|
44
|
+
'image metadef resource type association delete '
|
|
45
|
+
f'{self.namespace_name} {self.resource_type_name}',
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
output = self.openstack(
|
|
49
|
+
'image metadef resource type list',
|
|
50
|
+
parse_output=True,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
self.assertIn(
|
|
54
|
+
self.resource_type_name, [item['Name'] for item in output]
|
|
55
|
+
)
|
|
@@ -124,7 +124,7 @@ class VolumeTests(common.BaseVolumeTests):
|
|
|
124
124
|
cmd_output["properties"],
|
|
125
125
|
)
|
|
126
126
|
self.assertEqual(
|
|
127
|
-
|
|
127
|
+
False,
|
|
128
128
|
cmd_output["bootable"],
|
|
129
129
|
)
|
|
130
130
|
self.wait_for_status("volume", name, "available")
|
|
@@ -172,7 +172,7 @@ class VolumeTests(common.BaseVolumeTests):
|
|
|
172
172
|
cmd_output["volume_image_metadata"],
|
|
173
173
|
)
|
|
174
174
|
self.assertEqual(
|
|
175
|
-
|
|
175
|
+
True,
|
|
176
176
|
cmd_output["bootable"],
|
|
177
177
|
)
|
|
178
178
|
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
2
|
+
# not use this file except in compliance with the License. You may obtain
|
|
3
|
+
# a copy of the License at
|
|
4
|
+
#
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
#
|
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
9
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
|
+
# License for the specific language governing permissions and limitations
|
|
11
|
+
# under the License.
|
|
12
|
+
#
|
|
13
|
+
|
|
14
|
+
"""Volume v2 API Library Tests"""
|
|
15
|
+
|
|
16
|
+
import http
|
|
17
|
+
from unittest import mock
|
|
18
|
+
import uuid
|
|
19
|
+
|
|
20
|
+
from openstack.block_storage.v2 import _proxy
|
|
21
|
+
from osc_lib import exceptions as osc_lib_exceptions
|
|
22
|
+
|
|
23
|
+
from openstackclient.api import volume_v2 as volume
|
|
24
|
+
from openstackclient.tests.unit import fakes
|
|
25
|
+
from openstackclient.tests.unit import utils
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class TestConsistencyGroup(utils.TestCase):
|
|
29
|
+
def setUp(self):
|
|
30
|
+
super().setUp()
|
|
31
|
+
|
|
32
|
+
self.volume_sdk_client = mock.Mock(_proxy.Proxy)
|
|
33
|
+
|
|
34
|
+
def test_find_consistency_group_by_id(self):
|
|
35
|
+
cg_id = uuid.uuid4().hex
|
|
36
|
+
cg_name = 'name-' + uuid.uuid4().hex
|
|
37
|
+
data = {
|
|
38
|
+
'consistencygroup': {
|
|
39
|
+
'id': cg_id,
|
|
40
|
+
'name': cg_name,
|
|
41
|
+
'status': 'available',
|
|
42
|
+
'availability_zone': 'az1',
|
|
43
|
+
'created_at': '2015-09-16T09:28:52.000000',
|
|
44
|
+
'description': 'description-' + uuid.uuid4().hex,
|
|
45
|
+
'volume_types': ['123456'],
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
self.volume_sdk_client.get.side_effect = [
|
|
49
|
+
fakes.FakeResponse(data=data),
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
result = volume.find_consistency_group(self.volume_sdk_client, cg_id)
|
|
53
|
+
|
|
54
|
+
self.volume_sdk_client.get.assert_has_calls(
|
|
55
|
+
[
|
|
56
|
+
mock.call(f'/consistencygroups/{cg_id}'),
|
|
57
|
+
]
|
|
58
|
+
)
|
|
59
|
+
self.assertEqual(data['consistencygroup'], result)
|
|
60
|
+
|
|
61
|
+
def test_find_consistency_group_by_name(self):
|
|
62
|
+
cg_id = uuid.uuid4().hex
|
|
63
|
+
cg_name = 'name-' + uuid.uuid4().hex
|
|
64
|
+
data = {
|
|
65
|
+
'consistencygroups': [
|
|
66
|
+
{
|
|
67
|
+
'id': cg_id,
|
|
68
|
+
'name': cg_name,
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
}
|
|
72
|
+
self.volume_sdk_client.get.side_effect = [
|
|
73
|
+
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
74
|
+
fakes.FakeResponse(data=data),
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
result = volume.find_consistency_group(self.volume_sdk_client, cg_name)
|
|
78
|
+
|
|
79
|
+
self.volume_sdk_client.get.assert_has_calls(
|
|
80
|
+
[
|
|
81
|
+
mock.call(f'/consistencygroups/{cg_name}'),
|
|
82
|
+
mock.call('/consistencygroups'),
|
|
83
|
+
]
|
|
84
|
+
)
|
|
85
|
+
self.assertEqual(data['consistencygroups'][0], result)
|
|
86
|
+
|
|
87
|
+
def test_find_consistency_group_not_found(self):
|
|
88
|
+
data = {'consistencygroups': []}
|
|
89
|
+
self.volume_sdk_client.get.side_effect = [
|
|
90
|
+
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
91
|
+
fakes.FakeResponse(data=data),
|
|
92
|
+
]
|
|
93
|
+
self.assertRaises(
|
|
94
|
+
osc_lib_exceptions.NotFound,
|
|
95
|
+
volume.find_consistency_group,
|
|
96
|
+
self.volume_sdk_client,
|
|
97
|
+
'invalid-cg',
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
def test_find_consistency_group_by_name_duplicate(self):
|
|
101
|
+
cg_name = 'name-' + uuid.uuid4().hex
|
|
102
|
+
data = {
|
|
103
|
+
'consistencygroups': [
|
|
104
|
+
{
|
|
105
|
+
'id': uuid.uuid4().hex,
|
|
106
|
+
'name': cg_name,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
'id': uuid.uuid4().hex,
|
|
110
|
+
'name': cg_name,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
}
|
|
114
|
+
self.volume_sdk_client.get.side_effect = [
|
|
115
|
+
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
116
|
+
fakes.FakeResponse(data=data),
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
self.assertRaises(
|
|
120
|
+
osc_lib_exceptions.NotFound,
|
|
121
|
+
volume.find_consistency_group,
|
|
122
|
+
self.volume_sdk_client,
|
|
123
|
+
cg_name,
|
|
124
|
+
)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
2
|
+
# not use this file except in compliance with the License. You may obtain
|
|
3
|
+
# a copy of the License at
|
|
4
|
+
#
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
#
|
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
9
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
|
+
# License for the specific language governing permissions and limitations
|
|
11
|
+
# under the License.
|
|
12
|
+
#
|
|
13
|
+
|
|
14
|
+
"""Volume v3 API Library Tests"""
|
|
15
|
+
|
|
16
|
+
import http
|
|
17
|
+
from unittest import mock
|
|
18
|
+
import uuid
|
|
19
|
+
|
|
20
|
+
from openstack.block_storage.v3 import _proxy
|
|
21
|
+
from osc_lib import exceptions as osc_lib_exceptions
|
|
22
|
+
|
|
23
|
+
from openstackclient.api import volume_v3 as volume
|
|
24
|
+
from openstackclient.tests.unit import fakes
|
|
25
|
+
from openstackclient.tests.unit import utils
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class TestConsistencyGroup(utils.TestCase):
|
|
29
|
+
def setUp(self):
|
|
30
|
+
super().setUp()
|
|
31
|
+
|
|
32
|
+
self.volume_sdk_client = mock.Mock(_proxy.Proxy)
|
|
33
|
+
|
|
34
|
+
def test_find_consistency_group_by_id(self):
|
|
35
|
+
cg_id = uuid.uuid4().hex
|
|
36
|
+
cg_name = 'name-' + uuid.uuid4().hex
|
|
37
|
+
data = {
|
|
38
|
+
'consistencygroup': {
|
|
39
|
+
'id': cg_id,
|
|
40
|
+
'name': cg_name,
|
|
41
|
+
'status': 'available',
|
|
42
|
+
'availability_zone': 'az1',
|
|
43
|
+
'created_at': '2015-09-16T09:28:52.000000',
|
|
44
|
+
'description': 'description-' + uuid.uuid4().hex,
|
|
45
|
+
'volume_types': ['123456'],
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
self.volume_sdk_client.get.side_effect = [
|
|
49
|
+
fakes.FakeResponse(data=data),
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
result = volume.find_consistency_group(self.volume_sdk_client, cg_id)
|
|
53
|
+
|
|
54
|
+
self.volume_sdk_client.get.assert_has_calls(
|
|
55
|
+
[
|
|
56
|
+
mock.call(f'/consistencygroups/{cg_id}'),
|
|
57
|
+
]
|
|
58
|
+
)
|
|
59
|
+
self.assertEqual(data['consistencygroup'], result)
|
|
60
|
+
|
|
61
|
+
def test_find_consistency_group_by_name(self):
|
|
62
|
+
cg_id = uuid.uuid4().hex
|
|
63
|
+
cg_name = 'name-' + uuid.uuid4().hex
|
|
64
|
+
data = {
|
|
65
|
+
'consistencygroups': [
|
|
66
|
+
{
|
|
67
|
+
'id': cg_id,
|
|
68
|
+
'name': cg_name,
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
}
|
|
72
|
+
self.volume_sdk_client.get.side_effect = [
|
|
73
|
+
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
74
|
+
fakes.FakeResponse(data=data),
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
result = volume.find_consistency_group(self.volume_sdk_client, cg_name)
|
|
78
|
+
|
|
79
|
+
self.volume_sdk_client.get.assert_has_calls(
|
|
80
|
+
[
|
|
81
|
+
mock.call(f'/consistencygroups/{cg_name}'),
|
|
82
|
+
mock.call('/consistencygroups'),
|
|
83
|
+
]
|
|
84
|
+
)
|
|
85
|
+
self.assertEqual(data['consistencygroups'][0], result)
|
|
86
|
+
|
|
87
|
+
def test_find_consistency_group_not_found(self):
|
|
88
|
+
data = {'consistencygroups': []}
|
|
89
|
+
self.volume_sdk_client.get.side_effect = [
|
|
90
|
+
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
91
|
+
fakes.FakeResponse(data=data),
|
|
92
|
+
]
|
|
93
|
+
self.assertRaises(
|
|
94
|
+
osc_lib_exceptions.NotFound,
|
|
95
|
+
volume.find_consistency_group,
|
|
96
|
+
self.volume_sdk_client,
|
|
97
|
+
'invalid-cg',
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
def test_find_consistency_group_by_name_duplicate(self):
|
|
101
|
+
cg_name = 'name-' + uuid.uuid4().hex
|
|
102
|
+
data = {
|
|
103
|
+
'consistencygroups': [
|
|
104
|
+
{
|
|
105
|
+
'id': uuid.uuid4().hex,
|
|
106
|
+
'name': cg_name,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
'id': uuid.uuid4().hex,
|
|
110
|
+
'name': cg_name,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
}
|
|
114
|
+
self.volume_sdk_client.get.side_effect = [
|
|
115
|
+
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
116
|
+
fakes.FakeResponse(data=data),
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
self.assertRaises(
|
|
120
|
+
osc_lib_exceptions.NotFound,
|
|
121
|
+
volume.find_consistency_group,
|
|
122
|
+
self.volume_sdk_client,
|
|
123
|
+
cg_name,
|
|
124
|
+
)
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
from unittest import mock
|
|
16
16
|
|
|
17
|
-
from osc_lib.command import command
|
|
18
17
|
from osc_lib import exceptions
|
|
19
18
|
|
|
19
|
+
from openstackclient import command
|
|
20
20
|
from openstackclient.tests.unit import fakes as test_fakes
|
|
21
21
|
from openstackclient.tests.unit import utils as test_utils
|
|
22
22
|
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
12
|
|
|
13
|
-
from unittest import mock
|
|
14
13
|
|
|
15
14
|
from openstackclient.common import extension
|
|
16
15
|
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
|
|
@@ -295,8 +294,8 @@ class TestExtensionShow(TestExtension):
|
|
|
295
294
|
|
|
296
295
|
self.cmd = extension.ShowExtension(self.app, None)
|
|
297
296
|
|
|
298
|
-
self.app.client_manager.network.find_extension =
|
|
299
|
-
|
|
297
|
+
self.app.client_manager.network.find_extension.return_value = (
|
|
298
|
+
self.extension_details
|
|
300
299
|
)
|
|
301
300
|
|
|
302
301
|
def test_show_no_options(self):
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
12
12
|
# License for the specific language governing permissions and limitations
|
|
13
13
|
# under the License.
|
|
14
|
-
#
|
|
15
14
|
|
|
16
15
|
"""Test module module"""
|
|
17
16
|
|
|
@@ -19,10 +18,18 @@ import sys
|
|
|
19
18
|
from unittest import mock
|
|
20
19
|
|
|
21
20
|
from openstackclient.common import module as osc_module
|
|
22
|
-
from openstackclient.tests.unit import fakes
|
|
23
21
|
from openstackclient.tests.unit import utils
|
|
24
22
|
|
|
25
23
|
|
|
24
|
+
class FakeModule:
|
|
25
|
+
def __init__(self, name, version):
|
|
26
|
+
self.name = name
|
|
27
|
+
self.__version__ = version
|
|
28
|
+
# Workaround for openstacksdk case
|
|
29
|
+
self.version = mock.Mock()
|
|
30
|
+
self.version.__version__ = version
|
|
31
|
+
|
|
32
|
+
|
|
26
33
|
# NOTE(dtroyer): module_1 must match the version list filter (not --all)
|
|
27
34
|
# currently == '*client*'
|
|
28
35
|
module_name_1 = 'fakeclient'
|
|
@@ -45,11 +52,11 @@ module_version_5 = '0.0.1'
|
|
|
45
52
|
|
|
46
53
|
MODULES = {
|
|
47
54
|
'sys': sys,
|
|
48
|
-
module_name_1:
|
|
49
|
-
module_name_2:
|
|
50
|
-
module_name_3:
|
|
51
|
-
module_name_4:
|
|
52
|
-
module_name_5:
|
|
55
|
+
module_name_1: FakeModule(module_name_1, module_version_1),
|
|
56
|
+
module_name_2: FakeModule(module_name_2, module_version_2),
|
|
57
|
+
module_name_3: FakeModule(module_name_3, module_version_3),
|
|
58
|
+
module_name_4: FakeModule(module_name_4, module_version_4),
|
|
59
|
+
module_name_5: FakeModule(module_name_5, module_version_5),
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
|
|
@@ -1041,6 +1041,26 @@ class TestQuotaShow(TestQuota):
|
|
|
1041
1041
|
)
|
|
1042
1042
|
self.assertNotCalled(self.network_client.get_quota_default)
|
|
1043
1043
|
|
|
1044
|
+
def test_quota_show__missing_services(self):
|
|
1045
|
+
self.app.client_manager.compute_endpoint_enabled = False
|
|
1046
|
+
self.app.client_manager.volume_endpoint_enabled = False
|
|
1047
|
+
self.app.client_manager.network_endpoint_enabled = False
|
|
1048
|
+
|
|
1049
|
+
arglist = [
|
|
1050
|
+
self.projects[0].name,
|
|
1051
|
+
]
|
|
1052
|
+
verifylist = [
|
|
1053
|
+
('service', 'all'),
|
|
1054
|
+
('project', self.projects[0].name),
|
|
1055
|
+
]
|
|
1056
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1057
|
+
|
|
1058
|
+
self.cmd.take_action(parsed_args)
|
|
1059
|
+
|
|
1060
|
+
self.compute_client.get_quota_set.assert_not_called()
|
|
1061
|
+
self.volume_sdk_client.get_quota_set.assert_not_called()
|
|
1062
|
+
self.network_client.get_quota.assert_not_called()
|
|
1063
|
+
|
|
1044
1064
|
def test_quota_show__with_compute(self):
|
|
1045
1065
|
arglist = [
|
|
1046
1066
|
'--compute',
|
|
@@ -165,9 +165,11 @@ class TestAggregateDelete(TestAggregate):
|
|
|
165
165
|
sdk_fakes.generate_fake_resources(_aggregate.Aggregate, 2)
|
|
166
166
|
)
|
|
167
167
|
|
|
168
|
-
self.compute_client.find_aggregate =
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
self.compute_client.find_aggregate.side_effect = [
|
|
169
|
+
self.fake_ags[0],
|
|
170
|
+
self.fake_ags[1],
|
|
171
|
+
]
|
|
172
|
+
|
|
171
173
|
self.cmd = aggregate.DeleteAggregate(self.app, None)
|
|
172
174
|
|
|
173
175
|
def test_aggregate_delete(self):
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
# under the License.
|
|
14
14
|
#
|
|
15
15
|
|
|
16
|
-
from unittest import mock
|
|
17
16
|
|
|
18
17
|
from openstack.compute.v2 import server as _server
|
|
19
18
|
from openstack.test import fakes as sdk_fakes
|
|
@@ -90,9 +89,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
|
|
90
89
|
'protocol': 'fake_protocol',
|
|
91
90
|
'type': 'fake_type',
|
|
92
91
|
}
|
|
93
|
-
self.compute_client.create_console =
|
|
94
|
-
return_value=fake_console_data
|
|
95
|
-
)
|
|
92
|
+
self.compute_client.create_console.return_value = fake_console_data
|
|
96
93
|
|
|
97
94
|
self.columns = (
|
|
98
95
|
'protocol',
|