python-openstackclient 8.3.0__py3-none-any.whl → 10.0.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/__init__.py +2 -6
- openstackclient/api/api.py +41 -23
- openstackclient/api/compute_v2.py +44 -25
- openstackclient/api/object_store_v1.py +75 -97
- openstackclient/api/volume_v2.py +2 -1
- openstackclient/api/volume_v3.py +2 -1
- openstackclient/common/availability_zone.py +58 -42
- openstackclient/common/clientmanager.py +56 -29
- openstackclient/common/configuration.py +10 -3
- openstackclient/common/envvars.py +2 -2
- openstackclient/common/extension.py +14 -5
- openstackclient/common/limits.py +10 -5
- openstackclient/common/module.py +14 -6
- openstackclient/common/pagination.py +8 -2
- openstackclient/common/progressbar.py +7 -6
- openstackclient/common/project_cleanup.py +13 -7
- openstackclient/common/quota.py +126 -114
- openstackclient/common/versions.py +8 -2
- openstackclient/compute/client.py +7 -3
- openstackclient/compute/v2/agent.py +17 -10
- openstackclient/compute/v2/aggregate.py +36 -22
- openstackclient/compute/v2/console.py +14 -8
- openstackclient/compute/v2/console_connection.py +11 -3
- openstackclient/compute/v2/flavor.py +39 -21
- openstackclient/compute/v2/host.py +14 -6
- openstackclient/compute/v2/hypervisor.py +14 -5
- openstackclient/compute/v2/hypervisor_stats.py +10 -2
- openstackclient/compute/v2/keypair.py +29 -14
- openstackclient/compute/v2/server.py +251 -171
- openstackclient/compute/v2/server_backup.py +10 -4
- openstackclient/compute/v2/server_event.py +21 -12
- openstackclient/compute/v2/server_group.py +21 -11
- openstackclient/compute/v2/server_image.py +19 -10
- openstackclient/compute/v2/server_migration.py +24 -10
- openstackclient/compute/v2/server_share.py +274 -0
- openstackclient/compute/v2/server_volume.py +10 -4
- openstackclient/compute/v2/service.py +14 -7
- openstackclient/compute/v2/usage.py +26 -21
- openstackclient/identity/client.py +8 -3
- openstackclient/identity/common.py +103 -41
- openstackclient/identity/v2_0/catalog.py +14 -7
- openstackclient/identity/v2_0/ec2creds.py +21 -10
- openstackclient/identity/v2_0/endpoint.py +23 -11
- openstackclient/identity/v2_0/project.py +25 -14
- openstackclient/identity/v2_0/role.py +28 -14
- openstackclient/identity/v2_0/role_assignment.py +9 -3
- openstackclient/identity/v2_0/service.py +26 -12
- openstackclient/identity/v2_0/token.py +12 -5
- openstackclient/identity/v2_0/user.py +26 -15
- openstackclient/identity/v3/access_rule.py +26 -12
- openstackclient/identity/v3/application_credential.py +59 -24
- openstackclient/identity/v3/catalog.py +14 -7
- openstackclient/identity/v3/consumer.py +22 -11
- openstackclient/identity/v3/credential.py +36 -16
- openstackclient/identity/v3/domain.py +37 -18
- openstackclient/identity/v3/ec2creds.py +25 -12
- openstackclient/identity/v3/endpoint.py +42 -20
- openstackclient/identity/v3/endpoint_group.py +28 -17
- openstackclient/identity/v3/federation_protocol.py +71 -50
- openstackclient/identity/v3/group.py +55 -32
- openstackclient/identity/v3/identity_provider.py +92 -57
- openstackclient/identity/v3/implied_role.py +21 -9
- openstackclient/identity/v3/limit.py +115 -92
- openstackclient/identity/v3/mapping.py +26 -13
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +211 -122
- openstackclient/identity/v3/region.py +36 -16
- openstackclient/identity/v3/registered_limit.py +116 -109
- openstackclient/identity/v3/role.py +61 -31
- openstackclient/identity/v3/role_assignment.py +23 -6
- openstackclient/identity/v3/service.py +36 -16
- openstackclient/identity/v3/service_provider.py +37 -15
- openstackclient/identity/v3/tag.py +23 -17
- openstackclient/identity/v3/token.py +30 -14
- openstackclient/identity/v3/trust.py +32 -14
- openstackclient/identity/v3/unscoped_saml.py +10 -2
- openstackclient/identity/v3/user.py +49 -26
- openstackclient/image/client.py +7 -3
- openstackclient/image/v1/image.py +33 -26
- openstackclient/image/v2/cache.py +14 -9
- openstackclient/image/v2/image.py +76 -49
- openstackclient/image/v2/info.py +7 -1
- openstackclient/image/v2/metadef_namespaces.py +109 -13
- openstackclient/image/v2/metadef_objects.py +28 -15
- openstackclient/image/v2/metadef_properties.py +24 -13
- openstackclient/image/v2/metadef_resource_type_association.py +14 -7
- openstackclient/image/v2/metadef_resource_types.py +7 -1
- openstackclient/image/v2/task.py +15 -6
- openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +7 -192
- openstackclient/network/client.py +7 -2
- openstackclient/network/common.py +16 -241
- openstackclient/network/utils.py +36 -22
- openstackclient/network/v2/address_group.py +27 -16
- openstackclient/network/v2/address_scope.py +24 -13
- openstackclient/network/v2/bgpvpn/bgpvpn.py +463 -0
- openstackclient/network/v2/bgpvpn/constants.py +30 -0
- openstackclient/network/v2/bgpvpn/network_association.py +214 -0
- openstackclient/network/v2/bgpvpn/port_association.py +490 -0
- openstackclient/network/v2/bgpvpn/router_association.py +288 -0
- openstackclient/network/v2/default_security_group_rule.py +19 -10
- openstackclient/network/v2/floating_ip.py +110 -159
- openstackclient/network/v2/floating_ip_port_forwarding.py +30 -18
- openstackclient/network/v2/fwaas/__init__.py +0 -0
- openstackclient/network/v2/fwaas/group.py +466 -0
- openstackclient/network/v2/fwaas/policy.py +518 -0
- openstackclient/network/v2/fwaas/rule.py +574 -0
- openstackclient/network/v2/ip_availability.py +13 -5
- openstackclient/network/v2/l3_conntrack_helper.py +22 -13
- openstackclient/network/v2/local_ip.py +24 -13
- openstackclient/network/v2/local_ip_association.py +14 -7
- openstackclient/network/v2/ndp_proxy.py +20 -11
- openstackclient/network/v2/network.py +129 -196
- openstackclient/network/v2/network_agent.py +46 -25
- openstackclient/network/v2/network_auto_allocated_topology.py +22 -11
- openstackclient/network/v2/network_flavor.py +27 -16
- openstackclient/network/v2/network_flavor_profile.py +23 -12
- openstackclient/network/v2/network_meter.py +21 -10
- openstackclient/network/v2/network_meter_rule.py +21 -11
- openstackclient/network/v2/network_qos_policy.py +25 -15
- openstackclient/network/v2/network_qos_rule.py +32 -17
- openstackclient/network/v2/network_qos_rule_type.py +13 -5
- openstackclient/network/v2/network_rbac.py +23 -12
- openstackclient/network/v2/network_segment.py +20 -11
- openstackclient/network/v2/network_segment_range.py +56 -29
- openstackclient/network/v2/network_service_provider.py +7 -1
- openstackclient/network/v2/network_trunk.py +38 -22
- openstackclient/network/v2/port.py +54 -29
- openstackclient/network/v2/router.py +75 -52
- openstackclient/network/v2/security_group.py +87 -157
- openstackclient/network/v2/security_group_rule.py +100 -280
- openstackclient/network/v2/subnet.py +49 -28
- openstackclient/network/v2/subnet_pool.py +30 -17
- openstackclient/network/v2/taas/tap_flow.py +22 -11
- openstackclient/network/v2/taas/tap_mirror.py +22 -11
- openstackclient/network/v2/taas/tap_service.py +23 -12
- openstackclient/object/client.py +7 -2
- openstackclient/object/v1/account.py +13 -6
- openstackclient/object/v1/container.py +25 -15
- openstackclient/object/v1/object.py +25 -15
- openstackclient/py.typed +0 -0
- openstackclient/shell.py +46 -10
- openstackclient/tests/functional/base.py +55 -20
- openstackclient/tests/functional/common/test_extension.py +4 -0
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +14 -13
- openstackclient/tests/functional/compute/v2/test_flavor.py +3 -1
- openstackclient/tests/functional/compute/v2/test_server.py +3 -0
- openstackclient/tests/functional/identity/v2/common.py +10 -6
- openstackclient/tests/functional/identity/v2/test_role.py +4 -4
- openstackclient/tests/functional/identity/v3/common.py +25 -19
- openstackclient/tests/functional/identity/v3/test_group.py +20 -20
- openstackclient/tests/functional/identity/v3/test_idp.py +3 -1
- openstackclient/tests/functional/identity/v3/test_limit.py +47 -0
- openstackclient/tests/functional/identity/v3/test_project.py +10 -10
- openstackclient/tests/functional/identity/v3/test_role.py +18 -18
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +12 -12
- openstackclient/tests/functional/identity/v3/test_user.py +8 -8
- openstackclient/tests/functional/image/base.py +1 -6
- openstackclient/tests/functional/image/v2/test_metadef_objects.py +69 -0
- openstackclient/tests/functional/network/v2/common.py +5 -2
- openstackclient/tests/functional/network/v2/test_floating_ip.py +10 -4
- openstackclient/tests/functional/network/v2/test_ip_availability.py +4 -0
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +3 -2
- openstackclient/tests/functional/network/v2/test_network_segment.py +5 -0
- openstackclient/tests/functional/network/v2/test_subnet.py +13 -9
- openstackclient/tests/functional/object/v1/common.py +4 -0
- openstackclient/tests/functional/volume/v2/common.py +4 -0
- openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +27 -11
- openstackclient/tests/functional/volume/v2/test_volume_type.py +2 -2
- openstackclient/tests/functional/volume/v3/common.py +4 -0
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +56 -138
- openstackclient/tests/functional/volume/v3/test_volume_type.py +2 -2
- openstackclient/tests/unit/common/test_availability_zone.py +35 -49
- openstackclient/tests/unit/common/test_extension.py +2 -2
- openstackclient/tests/unit/common/test_module.py +12 -7
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +62 -23
- openstackclient/tests/unit/compute/v2/fakes.py +25 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +28 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +6 -6
- openstackclient/tests/unit/compute/v2/test_server.py +17 -104
- openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
- openstackclient/tests/unit/identity/v3/fakes.py +3 -0
- openstackclient/tests/unit/identity/v3/test_group.py +4 -14
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
- openstackclient/tests/unit/identity/v3/test_limit.py +197 -145
- openstackclient/tests/unit/identity/v3/test_project.py +831 -512
- openstackclient/tests/unit/identity/v3/test_protocol.py +97 -88
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +355 -220
- openstackclient/tests/unit/identity/v3/test_user.py +4 -4
- openstackclient/tests/unit/image/v2/test_image.py +16 -16
- openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +105 -6
- openstackclient/tests/unit/network/test_common.py +0 -155
- openstackclient/tests/unit/network/v2/bgpvpn/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/bgpvpn/fakes.py +179 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_bgpvpn.py +584 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_network_association.py +285 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_port_association.py +384 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_router_association.py +297 -0
- openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +897 -0
- openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +980 -0
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_flow.py → test_tap_flow.py} +18 -25
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_mirror.py → test_tap_mirror.py} +19 -29
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_service.py → test_tap_service.py} +19 -29
- openstackclient/tests/unit/network/v2/test_address_group.py +2 -2
- openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +3 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +13 -13
- openstackclient/tests/unit/network/v2/test_network_agent.py +8 -4
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
- openstackclient/tests/unit/network/v2/test_network_flavor.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_rbac.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +7 -10
- openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/unit/network/v2/test_router.py +8 -9
- openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +1 -20
- openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +7 -41
- openstackclient/tests/unit/network/v2/test_subnet.py +2 -1
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +2 -1
- openstackclient/tests/unit/object/v1/fakes.py +8 -7
- openstackclient/tests/unit/object/v1/test_container.py +65 -101
- openstackclient/tests/unit/object/v1/test_container_all.py +8 -1
- openstackclient/tests/unit/object/v1/test_object.py +44 -84
- openstackclient/tests/unit/object/v1/test_object_all.py +8 -1
- openstackclient/tests/unit/test_hacking.py +108 -0
- openstackclient/tests/unit/volume/v2/fakes.py +1 -0
- openstackclient/tests/unit/volume/v2/test_consistency_group.py +8 -2
- openstackclient/tests/unit/volume/v2/test_volume.py +7 -6
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +2 -1
- openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
- openstackclient/tests/unit/volume/v3/fakes.py +1 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +94 -15
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +55 -1
- openstackclient/tests/unit/volume/v3/test_volume_type.py +2 -4
- openstackclient/volume/client.py +7 -3
- openstackclient/volume/v2/backup_record.py +15 -6
- openstackclient/volume/v2/consistency_group.py +37 -25
- openstackclient/volume/v2/consistency_group_snapshot.py +27 -12
- openstackclient/volume/v2/qos_specs.py +30 -19
- openstackclient/volume/v2/service.py +17 -6
- openstackclient/volume/v2/volume.py +69 -34
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +48 -22
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +52 -26
- openstackclient/volume/v2/volume_transfer_request.py +33 -15
- openstackclient/volume/v2/volume_type.py +46 -27
- openstackclient/volume/v3/block_storage_cleanup.py +11 -3
- openstackclient/volume/v3/block_storage_cluster.py +19 -7
- openstackclient/volume/v3/block_storage_log_level.py +15 -6
- openstackclient/volume/v3/block_storage_manage.py +10 -4
- openstackclient/volume/v3/block_storage_resource_filter.py +17 -5
- openstackclient/volume/v3/service.py +16 -6
- openstackclient/volume/v3/volume.py +103 -46
- openstackclient/volume/v3/volume_attachment.py +43 -21
- openstackclient/volume/v3/volume_backup.py +55 -26
- openstackclient/volume/v3/volume_group.py +23 -13
- openstackclient/volume/v3/volume_group_snapshot.py +32 -13
- openstackclient/volume/v3/volume_group_type.py +26 -13
- openstackclient/volume/v3/volume_message.py +15 -7
- openstackclient/volume/v3/volume_snapshot.py +71 -34
- openstackclient/volume/v3/volume_transfer_request.py +33 -15
- openstackclient/volume/v3/volume_type.py +45 -27
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/METADATA +6 -6
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/RECORD +279 -267
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/entry_points.txt +53 -1
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/AUTHORS +9 -0
- python_openstackclient-10.0.0.dist-info/pbr.json +1 -0
- openstackclient/api/image_v1.py +0 -69
- openstackclient/api/image_v2.py +0 -79
- openstackclient/network/v2/floating_ip_pool.py +0 -38
- openstackclient/tests/functional/image/v1/test_image.py +0 -97
- openstackclient/tests/unit/api/test_image_v1.py +0 -96
- openstackclient/tests/unit/api/test_image_v2.py +0 -96
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +0 -248
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +0 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +0 -39
- openstackclient/tests/unit/network/v2/test_network_compute.py +0 -404
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +0 -392
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +0 -555
- python_openstackclient-8.3.0.dist-info/pbr.json +0 -1
- /openstackclient/{tests/functional/image/v1 → network/v2/bgpvpn}/__init__.py +0 -0
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-8.3.0.dist-info → python_openstackclient-10.0.0.dist-info}/top_level.txt +0 -0
|
@@ -14,29 +14,12 @@
|
|
|
14
14
|
#
|
|
15
15
|
|
|
16
16
|
import copy
|
|
17
|
-
from unittest import mock
|
|
18
17
|
|
|
19
|
-
from openstackclient.api import object_store_v1 as object_store
|
|
20
18
|
from openstackclient.object.v1 import object as obj
|
|
21
19
|
from openstackclient.tests.unit.object.v1 import fakes as object_fakes
|
|
22
20
|
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
AUTH_URL = "http://0.0.0.0"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class TestObject(object_fakes.TestObjectv1):
|
|
29
|
-
def setUp(self):
|
|
30
|
-
super().setUp()
|
|
31
|
-
self.app.client_manager.object_store = object_store.APIv1(
|
|
32
|
-
session=mock.Mock(),
|
|
33
|
-
service_type="object-store",
|
|
34
|
-
)
|
|
35
|
-
self.api = self.app.client_manager.object_store
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@mock.patch('openstackclient.api.object_store_v1.APIv1.object_list')
|
|
39
|
-
class TestObjectList(TestObject):
|
|
22
|
+
class TestObjectList(object_fakes.TestObjectV1):
|
|
40
23
|
columns = ('Name',)
|
|
41
24
|
datalist = ((object_fakes.object_name_2,),)
|
|
42
25
|
|
|
@@ -46,8 +29,8 @@ class TestObjectList(TestObject):
|
|
|
46
29
|
# Get the command object to test
|
|
47
30
|
self.cmd = obj.ListObject(self.app, None)
|
|
48
31
|
|
|
49
|
-
def test_object_list_objects_no_options(self
|
|
50
|
-
|
|
32
|
+
def test_object_list_objects_no_options(self):
|
|
33
|
+
self.object_store_client.object_list.return_value = [
|
|
51
34
|
copy.deepcopy(object_fakes.OBJECT),
|
|
52
35
|
copy.deepcopy(object_fakes.OBJECT_2),
|
|
53
36
|
]
|
|
@@ -65,7 +48,7 @@ class TestObjectList(TestObject):
|
|
|
65
48
|
# containing the data to be listed.
|
|
66
49
|
columns, data = self.cmd.take_action(parsed_args)
|
|
67
50
|
|
|
68
|
-
|
|
51
|
+
self.object_store_client.object_list.assert_called_with(
|
|
69
52
|
container=object_fakes.container_name,
|
|
70
53
|
)
|
|
71
54
|
|
|
@@ -76,8 +59,8 @@ class TestObjectList(TestObject):
|
|
|
76
59
|
)
|
|
77
60
|
self.assertEqual(datalist, tuple(data))
|
|
78
61
|
|
|
79
|
-
def test_object_list_objects_prefix(self
|
|
80
|
-
|
|
62
|
+
def test_object_list_objects_prefix(self):
|
|
63
|
+
self.object_store_client.object_list.return_value = [
|
|
81
64
|
copy.deepcopy(object_fakes.OBJECT_2),
|
|
82
65
|
]
|
|
83
66
|
|
|
@@ -97,19 +80,16 @@ class TestObjectList(TestObject):
|
|
|
97
80
|
# containing the data to be listed.
|
|
98
81
|
columns, data = self.cmd.take_action(parsed_args)
|
|
99
82
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
o_mock.assert_called_with(
|
|
105
|
-
container=object_fakes.container_name_2, **kwargs
|
|
83
|
+
self.object_store_client.object_list.assert_called_with(
|
|
84
|
+
container=object_fakes.container_name_2,
|
|
85
|
+
prefix='floppy',
|
|
106
86
|
)
|
|
107
87
|
|
|
108
88
|
self.assertEqual(self.columns, columns)
|
|
109
89
|
self.assertEqual(self.datalist, tuple(data))
|
|
110
90
|
|
|
111
|
-
def test_object_list_objects_delimiter(self
|
|
112
|
-
|
|
91
|
+
def test_object_list_objects_delimiter(self):
|
|
92
|
+
self.object_store_client.object_list.return_value = [
|
|
113
93
|
copy.deepcopy(object_fakes.OBJECT_2),
|
|
114
94
|
]
|
|
115
95
|
|
|
@@ -129,19 +109,16 @@ class TestObjectList(TestObject):
|
|
|
129
109
|
# containing the data to be listed.
|
|
130
110
|
columns, data = self.cmd.take_action(parsed_args)
|
|
131
111
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
o_mock.assert_called_with(
|
|
137
|
-
container=object_fakes.container_name_2, **kwargs
|
|
112
|
+
self.object_store_client.object_list.assert_called_with(
|
|
113
|
+
container=object_fakes.container_name_2,
|
|
114
|
+
delimiter='=',
|
|
138
115
|
)
|
|
139
116
|
|
|
140
117
|
self.assertEqual(self.columns, columns)
|
|
141
118
|
self.assertEqual(self.datalist, tuple(data))
|
|
142
119
|
|
|
143
|
-
def test_object_list_objects_marker(self
|
|
144
|
-
|
|
120
|
+
def test_object_list_objects_marker(self):
|
|
121
|
+
self.object_store_client.object_list.return_value = [
|
|
145
122
|
copy.deepcopy(object_fakes.OBJECT_2),
|
|
146
123
|
]
|
|
147
124
|
|
|
@@ -161,19 +138,16 @@ class TestObjectList(TestObject):
|
|
|
161
138
|
# containing the data to be listed.
|
|
162
139
|
columns, data = self.cmd.take_action(parsed_args)
|
|
163
140
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
o_mock.assert_called_with(
|
|
169
|
-
container=object_fakes.container_name_2, **kwargs
|
|
141
|
+
self.object_store_client.object_list.assert_called_with(
|
|
142
|
+
container=object_fakes.container_name_2,
|
|
143
|
+
marker=object_fakes.object_name_2,
|
|
170
144
|
)
|
|
171
145
|
|
|
172
146
|
self.assertEqual(self.columns, columns)
|
|
173
147
|
self.assertEqual(self.datalist, tuple(data))
|
|
174
148
|
|
|
175
|
-
def test_object_list_objects_end_marker(self
|
|
176
|
-
|
|
149
|
+
def test_object_list_objects_end_marker(self):
|
|
150
|
+
self.object_store_client.object_list.return_value = [
|
|
177
151
|
copy.deepcopy(object_fakes.OBJECT_2),
|
|
178
152
|
]
|
|
179
153
|
|
|
@@ -193,19 +167,16 @@ class TestObjectList(TestObject):
|
|
|
193
167
|
# containing the data to be listed.
|
|
194
168
|
columns, data = self.cmd.take_action(parsed_args)
|
|
195
169
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
o_mock.assert_called_with(
|
|
201
|
-
container=object_fakes.container_name_2, **kwargs
|
|
170
|
+
self.object_store_client.object_list.assert_called_with(
|
|
171
|
+
container=object_fakes.container_name_2,
|
|
172
|
+
end_marker=object_fakes.object_name_2,
|
|
202
173
|
)
|
|
203
174
|
|
|
204
175
|
self.assertEqual(self.columns, columns)
|
|
205
176
|
self.assertEqual(self.datalist, tuple(data))
|
|
206
177
|
|
|
207
|
-
def test_object_list_objects_limit(self
|
|
208
|
-
|
|
178
|
+
def test_object_list_objects_limit(self):
|
|
179
|
+
self.object_store_client.object_list.return_value = [
|
|
209
180
|
copy.deepcopy(object_fakes.OBJECT_2),
|
|
210
181
|
]
|
|
211
182
|
|
|
@@ -225,19 +196,16 @@ class TestObjectList(TestObject):
|
|
|
225
196
|
# containing the data to be listed.
|
|
226
197
|
columns, data = self.cmd.take_action(parsed_args)
|
|
227
198
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
o_mock.assert_called_with(
|
|
233
|
-
container=object_fakes.container_name_2, **kwargs
|
|
199
|
+
self.object_store_client.object_list.assert_called_with(
|
|
200
|
+
container=object_fakes.container_name_2,
|
|
201
|
+
limit=2,
|
|
234
202
|
)
|
|
235
203
|
|
|
236
204
|
self.assertEqual(self.columns, columns)
|
|
237
205
|
self.assertEqual(self.datalist, tuple(data))
|
|
238
206
|
|
|
239
|
-
def test_object_list_objects_long(self
|
|
240
|
-
|
|
207
|
+
def test_object_list_objects_long(self):
|
|
208
|
+
self.object_store_client.object_list.return_value = [
|
|
241
209
|
copy.deepcopy(object_fakes.OBJECT),
|
|
242
210
|
copy.deepcopy(object_fakes.OBJECT_2),
|
|
243
211
|
]
|
|
@@ -257,10 +225,8 @@ class TestObjectList(TestObject):
|
|
|
257
225
|
# containing the data to be listed.
|
|
258
226
|
columns, data = self.cmd.take_action(parsed_args)
|
|
259
227
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
o_mock.assert_called_with(
|
|
263
|
-
container=object_fakes.container_name, **kwargs
|
|
228
|
+
self.object_store_client.object_list.assert_called_with(
|
|
229
|
+
container=object_fakes.container_name,
|
|
264
230
|
)
|
|
265
231
|
|
|
266
232
|
collist = ('Name', 'Bytes', 'Hash', 'Content Type', 'Last Modified')
|
|
@@ -283,8 +249,8 @@ class TestObjectList(TestObject):
|
|
|
283
249
|
)
|
|
284
250
|
self.assertEqual(datalist, tuple(data))
|
|
285
251
|
|
|
286
|
-
def test_object_list_objects_all(self
|
|
287
|
-
|
|
252
|
+
def test_object_list_objects_all(self):
|
|
253
|
+
self.object_store_client.object_list.return_value = [
|
|
288
254
|
copy.deepcopy(object_fakes.OBJECT),
|
|
289
255
|
copy.deepcopy(object_fakes.OBJECT_2),
|
|
290
256
|
]
|
|
@@ -304,12 +270,9 @@ class TestObjectList(TestObject):
|
|
|
304
270
|
# containing the data to be listed.
|
|
305
271
|
columns, data = self.cmd.take_action(parsed_args)
|
|
306
272
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
o_mock.assert_called_with(
|
|
312
|
-
container=object_fakes.container_name, **kwargs
|
|
273
|
+
self.object_store_client.object_list.assert_called_with(
|
|
274
|
+
container=object_fakes.container_name,
|
|
275
|
+
full_listing=True,
|
|
313
276
|
)
|
|
314
277
|
|
|
315
278
|
self.assertEqual(self.columns, columns)
|
|
@@ -320,16 +283,17 @@ class TestObjectList(TestObject):
|
|
|
320
283
|
self.assertEqual(datalist, tuple(data))
|
|
321
284
|
|
|
322
285
|
|
|
323
|
-
|
|
324
|
-
class TestObjectShow(TestObject):
|
|
286
|
+
class TestObjectShow(object_fakes.TestObjectV1):
|
|
325
287
|
def setUp(self):
|
|
326
288
|
super().setUp()
|
|
327
289
|
|
|
328
290
|
# Get the command object to test
|
|
329
291
|
self.cmd = obj.ShowObject(self.app, None)
|
|
330
292
|
|
|
331
|
-
def test_object_show(self
|
|
332
|
-
|
|
293
|
+
def test_object_show(self):
|
|
294
|
+
self.object_store_client.object_show.return_value = copy.deepcopy(
|
|
295
|
+
object_fakes.OBJECT
|
|
296
|
+
)
|
|
333
297
|
|
|
334
298
|
arglist = [
|
|
335
299
|
object_fakes.container_name,
|
|
@@ -346,13 +310,9 @@ class TestObjectShow(TestObject):
|
|
|
346
310
|
# data to be shown.
|
|
347
311
|
columns, data = self.cmd.take_action(parsed_args)
|
|
348
312
|
|
|
349
|
-
|
|
350
|
-
kwargs = {}
|
|
351
|
-
# lib.container.show_container(api, url, container)
|
|
352
|
-
c_mock.assert_called_with(
|
|
313
|
+
self.object_store_client.object_show.assert_called_with(
|
|
353
314
|
container=object_fakes.container_name,
|
|
354
315
|
object=object_fakes.object_name_1,
|
|
355
|
-
**kwargs,
|
|
356
316
|
)
|
|
357
317
|
|
|
358
318
|
collist = ('bytes', 'content_type', 'hash', 'last_modified', 'name')
|
|
@@ -15,18 +15,25 @@ import copy
|
|
|
15
15
|
import io
|
|
16
16
|
from unittest import mock
|
|
17
17
|
|
|
18
|
+
from keystoneauth1 import session
|
|
18
19
|
from osc_lib import exceptions
|
|
19
20
|
from requests_mock.contrib import fixture
|
|
20
21
|
|
|
22
|
+
from openstackclient.api import object_store_v1 as object_store
|
|
21
23
|
from openstackclient.object.v1 import object as object_cmds
|
|
22
24
|
from openstackclient.tests.unit.object.v1 import fakes as object_fakes
|
|
23
25
|
|
|
24
26
|
|
|
25
|
-
class TestObjectAll(object_fakes.
|
|
27
|
+
class TestObjectAll(object_fakes.TestObjectV1):
|
|
26
28
|
def setUp(self):
|
|
27
29
|
super().setUp()
|
|
28
30
|
|
|
31
|
+
# these tests require a "real" client since we mock requests
|
|
29
32
|
self.requests_mock = self.useFixture(fixture.Fixture())
|
|
33
|
+
self.app.client_manager.object_store = object_store.APIv1(
|
|
34
|
+
session=session.Session(),
|
|
35
|
+
endpoint=object_fakes.ENDPOINT,
|
|
36
|
+
)
|
|
30
37
|
|
|
31
38
|
|
|
32
39
|
class TestObjectCreate(TestObjectAll):
|
|
@@ -0,0 +1,108 @@
|
|
|
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 importlib.util
|
|
14
|
+
import os
|
|
15
|
+
import re
|
|
16
|
+
import subprocess
|
|
17
|
+
import sys
|
|
18
|
+
import unittest
|
|
19
|
+
|
|
20
|
+
import fixtures
|
|
21
|
+
|
|
22
|
+
ROOT_DIR = os.path.normpath(
|
|
23
|
+
os.path.join(os.path.dirname(__file__), '..', '..', '..')
|
|
24
|
+
)
|
|
25
|
+
SELFTEST_REGEX = re.compile(r'\b(Okay|[HEW]\d{3}|O\d{3}):\s(.*)')
|
|
26
|
+
|
|
27
|
+
# Checks that filter on 'openstackclient/tests/unit' in the filename need the
|
|
28
|
+
# temp file written into that path structure so the check is not skipped.
|
|
29
|
+
_UNIT_TEST_SUBDIRS = {
|
|
30
|
+
'O401': os.path.join('openstackclient', 'tests', 'unit'),
|
|
31
|
+
'O402': os.path.join('openstackclient', 'tests', 'unit'),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _load_checks():
|
|
36
|
+
spec = importlib.util.spec_from_file_location(
|
|
37
|
+
'_osc_hacking_checks',
|
|
38
|
+
os.path.join(ROOT_DIR, 'hacking', 'checks.py'),
|
|
39
|
+
)
|
|
40
|
+
module = importlib.util.module_from_spec(spec)
|
|
41
|
+
spec.loader.exec_module(module)
|
|
42
|
+
return module
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _get_examples(check):
|
|
46
|
+
for line in check.__doc__.splitlines():
|
|
47
|
+
line = line.lstrip()
|
|
48
|
+
match = SELFTEST_REGEX.match(line)
|
|
49
|
+
if match:
|
|
50
|
+
yield match.group(1), match.group(2)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class HackingTestCase(unittest.TestCase):
|
|
54
|
+
def _test_check(self, code, source):
|
|
55
|
+
lines = [
|
|
56
|
+
part.replace(r'\t', '\t') + '\n' for part in source.split(r'\n')
|
|
57
|
+
]
|
|
58
|
+
subdir = {
|
|
59
|
+
'O401': os.path.join('openstackclient', 'tests', 'unit'),
|
|
60
|
+
'O402': os.path.join('openstackclient', 'tests', 'unit'),
|
|
61
|
+
}.get(code, '')
|
|
62
|
+
|
|
63
|
+
with fixtures.TempDir() as tmp:
|
|
64
|
+
dirpath = os.path.join(tmp.path, subdir) if subdir else tmp.path
|
|
65
|
+
if subdir:
|
|
66
|
+
os.makedirs(dirpath)
|
|
67
|
+
|
|
68
|
+
fpath = os.path.join(dirpath, 'test_tmp.py')
|
|
69
|
+
with open(fpath, 'w') as f:
|
|
70
|
+
f.write(''.join(lines))
|
|
71
|
+
|
|
72
|
+
cmd = [
|
|
73
|
+
sys.executable,
|
|
74
|
+
'-mflake8',
|
|
75
|
+
'--config',
|
|
76
|
+
os.path.join(ROOT_DIR, 'tox.ini'),
|
|
77
|
+
f'--select={code}',
|
|
78
|
+
'--format=%(code)s\t%(path)s\t%(row)d',
|
|
79
|
+
fpath,
|
|
80
|
+
]
|
|
81
|
+
out, _ = subprocess.Popen(
|
|
82
|
+
cmd, stdout=subprocess.PIPE, cwd=ROOT_DIR
|
|
83
|
+
).communicate()
|
|
84
|
+
out = out.decode('utf-8')
|
|
85
|
+
|
|
86
|
+
if code == 'Okay':
|
|
87
|
+
self.assertEqual('', out)
|
|
88
|
+
else:
|
|
89
|
+
self.assertNotEqual('', out, f"Failed to trigger rule {code}")
|
|
90
|
+
self.assertEqual(code, out.split('\t')[0].rstrip(':'), out)
|
|
91
|
+
|
|
92
|
+
def test_checks(self):
|
|
93
|
+
checks_module = _load_checks()
|
|
94
|
+
|
|
95
|
+
for name in sorted(dir(checks_module)):
|
|
96
|
+
check = getattr(checks_module, name)
|
|
97
|
+
if not callable(check):
|
|
98
|
+
continue
|
|
99
|
+
|
|
100
|
+
if getattr(check, 'skip_on_py3', None) is not False:
|
|
101
|
+
continue
|
|
102
|
+
|
|
103
|
+
if not check.__doc__:
|
|
104
|
+
continue
|
|
105
|
+
|
|
106
|
+
for code, source in _get_examples(check):
|
|
107
|
+
with self.subTest(check=name, example=source):
|
|
108
|
+
self._test_check(code, source)
|
|
@@ -88,6 +88,7 @@ class FakeClientMixin:
|
|
|
88
88
|
self.app.client_manager.sdk_connection.volume = mock.Mock(
|
|
89
89
|
spec=block_storage_v2_proxy.Proxy,
|
|
90
90
|
)
|
|
91
|
+
self.app.client_manager.sdk_connection.volume.api_version = '2'
|
|
91
92
|
self.volume_sdk_client = self.app.client_manager.sdk_connection.volume
|
|
92
93
|
self.set_volume_api_version() # default to the lowest
|
|
93
94
|
|
|
@@ -129,7 +129,10 @@ class TestConsistencyGroupAddVolume(TestConsistencyGroup):
|
|
|
129
129
|
utils, 'find_resource', side_effect=find_mock_result
|
|
130
130
|
) as find_mock:
|
|
131
131
|
result = self.cmd.take_action(parsed_args)
|
|
132
|
-
mock_error.assert_called_with(
|
|
132
|
+
mock_error.assert_called_with(
|
|
133
|
+
'%(result)s of %(total)s volumes failed to add.',
|
|
134
|
+
{'result': 1, 'total': 2},
|
|
135
|
+
)
|
|
133
136
|
self.assertIsNone(result)
|
|
134
137
|
find_mock.assert_any_call(
|
|
135
138
|
self.consistencygroups_mock, self._consistency_group.id
|
|
@@ -602,7 +605,10 @@ class TestConsistencyGroupRemoveVolume(TestConsistencyGroup):
|
|
|
602
605
|
utils, 'find_resource', side_effect=find_mock_result
|
|
603
606
|
) as find_mock:
|
|
604
607
|
result = self.cmd.take_action(parsed_args)
|
|
605
|
-
mock_error.assert_called_with(
|
|
608
|
+
mock_error.assert_called_with(
|
|
609
|
+
'%(result)s of %(total)s volumes failed to remove.',
|
|
610
|
+
{'result': 1, 'total': 2},
|
|
611
|
+
)
|
|
606
612
|
self.assertIsNone(result)
|
|
607
613
|
find_mock.assert_any_call(
|
|
608
614
|
self.consistencygroups_mock, self._consistency_group.id
|
|
@@ -655,7 +655,7 @@ class TestVolumeDelete(volume_fakes.TestVolume):
|
|
|
655
655
|
arglist = [self.volumes[0].id]
|
|
656
656
|
verifylist = [
|
|
657
657
|
("force", False),
|
|
658
|
-
("
|
|
658
|
+
("cascade", False),
|
|
659
659
|
("volumes", [self.volumes[0].id]),
|
|
660
660
|
]
|
|
661
661
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -674,7 +674,7 @@ class TestVolumeDelete(volume_fakes.TestVolume):
|
|
|
674
674
|
arglist = [v.id for v in self.volumes]
|
|
675
675
|
verifylist = [
|
|
676
676
|
('force', False),
|
|
677
|
-
('
|
|
677
|
+
('cascade', False),
|
|
678
678
|
('volumes', arglist),
|
|
679
679
|
]
|
|
680
680
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -701,7 +701,7 @@ class TestVolumeDelete(volume_fakes.TestVolume):
|
|
|
701
701
|
]
|
|
702
702
|
verifylist = [
|
|
703
703
|
('force', False),
|
|
704
|
-
('
|
|
704
|
+
('cascade', False),
|
|
705
705
|
('volumes', [self.volumes[0].id, 'unexist_volume']),
|
|
706
706
|
]
|
|
707
707
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -732,7 +732,7 @@ class TestVolumeDelete(volume_fakes.TestVolume):
|
|
|
732
732
|
]
|
|
733
733
|
verifylist = [
|
|
734
734
|
('force', False),
|
|
735
|
-
('
|
|
735
|
+
('cascade', True),
|
|
736
736
|
('volumes', [self.volumes[0].id]),
|
|
737
737
|
]
|
|
738
738
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -754,7 +754,7 @@ class TestVolumeDelete(volume_fakes.TestVolume):
|
|
|
754
754
|
]
|
|
755
755
|
verifylist = [
|
|
756
756
|
('force', True),
|
|
757
|
-
('
|
|
757
|
+
('cascade', False),
|
|
758
758
|
('volumes', [self.volumes[0].id]),
|
|
759
759
|
]
|
|
760
760
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -1618,7 +1618,8 @@ class TestVolumeSet(TestVolume):
|
|
|
1618
1618
|
result = self.cmd.take_action(parsed_args)
|
|
1619
1619
|
self.volumes_mock.retype.assert_not_called()
|
|
1620
1620
|
mock_warning.assert_called_with(
|
|
1621
|
-
"'
|
|
1621
|
+
"'%s' option will not work without '--type' option",
|
|
1622
|
+
'--retype-policy',
|
|
1622
1623
|
)
|
|
1623
1624
|
self.assertIsNone(result)
|
|
1624
1625
|
|
|
@@ -220,11 +220,7 @@ class TestBackupList(volume_fakes.TestVolume):
|
|
|
220
220
|
'Incremental',
|
|
221
221
|
'Created At',
|
|
222
222
|
)
|
|
223
|
-
columns_long = columns
|
|
224
|
-
'Availability Zone',
|
|
225
|
-
'Volume',
|
|
226
|
-
'Container',
|
|
227
|
-
)
|
|
223
|
+
columns_long = (*columns, 'Availability Zone', 'Volume', 'Container')
|
|
228
224
|
|
|
229
225
|
def setUp(self):
|
|
230
226
|
super().setUp()
|
|
@@ -297,7 +297,8 @@ class TestVolumeSnapshotList(volume_fakes.TestVolume):
|
|
|
297
297
|
self.project_mock.get.return_value = self.project
|
|
298
298
|
|
|
299
299
|
self.columns = ("ID", "Name", "Description", "Status", "Size")
|
|
300
|
-
self.columns_long =
|
|
300
|
+
self.columns_long = (
|
|
301
|
+
*self.columns,
|
|
301
302
|
"Created At",
|
|
302
303
|
"Volume",
|
|
303
304
|
"Properties",
|
|
@@ -332,7 +332,7 @@ class TestTypeList(TestType):
|
|
|
332
332
|
"Name",
|
|
333
333
|
"Is Public",
|
|
334
334
|
]
|
|
335
|
-
columns_long = columns
|
|
335
|
+
columns_long = [*columns, "Description"]
|
|
336
336
|
data_with_default_type = [(volume_types[0].id, volume_types[0].name, True)]
|
|
337
337
|
data = []
|
|
338
338
|
for t in volume_types:
|
|
@@ -436,9 +436,7 @@ class TestTypeList(TestType):
|
|
|
436
436
|
'key_size': None,
|
|
437
437
|
'control_location': 'front-end',
|
|
438
438
|
}
|
|
439
|
-
encryption_columns = self.columns
|
|
440
|
-
"Encryption",
|
|
441
|
-
]
|
|
439
|
+
encryption_columns = [*self.columns, "Encryption"]
|
|
442
440
|
encryption_data = []
|
|
443
441
|
encryption_data.append(
|
|
444
442
|
(
|
|
@@ -96,6 +96,7 @@ class FakeClientMixin:
|
|
|
96
96
|
self.app.client_manager.sdk_connection.volume = mock.Mock(
|
|
97
97
|
spec=_proxy.Proxy,
|
|
98
98
|
)
|
|
99
|
+
self.app.client_manager.sdk_connection.volume.api_version = '3'
|
|
99
100
|
self.volume_sdk_client = self.app.client_manager.sdk_connection.volume
|
|
100
101
|
self.set_volume_api_version() # default to the lowest
|
|
101
102
|
|