python-openstackclient 6.3.0__py3-none-any.whl → 6.5.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/common/availability_zone.py +4 -4
- openstackclient/common/pagination.py +82 -0
- openstackclient/compute/v2/flavor.py +2 -16
- openstackclient/compute/v2/hypervisor.py +2 -21
- openstackclient/compute/v2/keypair.py +2 -9
- openstackclient/compute/v2/server.py +220 -131
- openstackclient/compute/v2/server_event.py +30 -19
- openstackclient/compute/v2/server_group.py +2 -23
- openstackclient/compute/v2/server_migration.py +2 -22
- openstackclient/compute/v2/usage.py +4 -6
- openstackclient/identity/v3/mapping.py +25 -3
- openstackclient/identity/v3/policy.py +3 -1
- openstackclient/image/v2/cache.py +218 -0
- openstackclient/image/v2/image.py +40 -17
- openstackclient/image/v2/metadef_namespaces.py +25 -21
- openstackclient/image/v2/metadef_objects.py +189 -0
- openstackclient/image/v2/metadef_properties.py +284 -0
- openstackclient/network/utils.py +100 -0
- openstackclient/network/v2/default_security_group_rule.py +418 -0
- openstackclient/network/v2/local_ip_association.py +1 -1
- openstackclient/network/v2/ndp_proxy.py +7 -3
- openstackclient/network/v2/network.py +2 -2
- openstackclient/network/v2/port.py +65 -19
- openstackclient/network/v2/security_group_rule.py +18 -111
- openstackclient/network/v2/subnet.py +1 -0
- openstackclient/object/v1/container.py +2 -12
- openstackclient/object/v1/object.py +2 -11
- openstackclient/tests/functional/base.py +13 -6
- openstackclient/tests/functional/identity/v3/test_role.py +11 -3
- openstackclient/tests/functional/network/v2/common.py +7 -1
- openstackclient/tests/functional/network/v2/test_address_group.py +2 -4
- openstackclient/tests/functional/network/v2/test_address_scope.py +0 -6
- openstackclient/tests/functional/network/v2/test_default_security_group_rule.py +67 -0
- openstackclient/tests/functional/network/v2/test_floating_ip.py +3 -6
- openstackclient/tests/functional/network/v2/test_ip_availability.py +3 -8
- openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +3 -4
- openstackclient/tests/functional/network/v2/test_local_ip.py +2 -4
- openstackclient/tests/functional/network/v2/test_network.py +18 -17
- openstackclient/tests/functional/network/v2/test_network_agent.py +24 -21
- openstackclient/tests/functional/network/v2/test_network_flavor.py +0 -6
- openstackclient/tests/functional/network/v2/test_network_flavor_profile.py +0 -6
- openstackclient/tests/functional/network/v2/test_network_meter.py +6 -6
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +7 -8
- openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +1 -3
- openstackclient/tests/functional/network/v2/test_network_qos_policy.py +4 -4
- openstackclient/tests/functional/network/v2/test_network_qos_rule.py +16 -20
- openstackclient/tests/functional/network/v2/test_network_qos_rule_type.py +4 -4
- openstackclient/tests/functional/network/v2/test_network_rbac.py +1 -4
- openstackclient/tests/functional/network/v2/test_network_segment.py +7 -12
- openstackclient/tests/functional/network/v2/test_network_segment_range.py +3 -4
- openstackclient/tests/functional/network/v2/test_network_service_provider.py +2 -4
- openstackclient/tests/functional/network/v2/test_network_trunk.py +3 -3
- openstackclient/tests/functional/network/v2/test_port.py +2 -8
- openstackclient/tests/functional/network/v2/test_router.py +0 -6
- openstackclient/tests/functional/network/v2/test_security_group.py +1 -4
- openstackclient/tests/functional/network/v2/test_security_group_rule.py +1 -4
- openstackclient/tests/functional/network/v2/test_subnet.py +4 -22
- openstackclient/tests/functional/network/v2/test_subnet_pool.py +0 -6
- openstackclient/tests/unit/common/test_availability_zone.py +28 -30
- openstackclient/tests/unit/common/test_extension.py +1 -4
- openstackclient/tests/unit/common/test_limits.py +2 -4
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -10
- openstackclient/tests/unit/common/test_quota.py +18 -24
- openstackclient/tests/unit/compute/v2/fakes.py +24 -11
- openstackclient/tests/unit/compute/v2/test_agent.py +1 -1
- openstackclient/tests/unit/compute/v2/test_aggregate.py +62 -72
- openstackclient/tests/unit/compute/v2/test_console.py +18 -30
- openstackclient/tests/unit/compute/v2/test_flavor.py +85 -89
- openstackclient/tests/unit/compute/v2/test_host.py +12 -19
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +23 -25
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -6
- openstackclient/tests/unit/compute/v2/test_keypair.py +25 -39
- openstackclient/tests/unit/compute/v2/test_server.py +316 -365
- openstackclient/tests/unit/compute/v2/test_server_backup.py +5 -17
- openstackclient/tests/unit/compute/v2/test_server_event.py +23 -25
- openstackclient/tests/unit/compute/v2/test_server_group.py +41 -33
- openstackclient/tests/unit/compute/v2/test_server_image.py +6 -18
- openstackclient/tests/unit/compute/v2/test_server_migration.py +45 -45
- openstackclient/tests/unit/compute/v2/test_server_volume.py +15 -31
- openstackclient/tests/unit/compute/v2/test_service.py +51 -56
- openstackclient/tests/unit/compute/v2/test_usage.py +10 -13
- openstackclient/tests/unit/fakes.py +4 -0
- openstackclient/tests/unit/identity/v3/test_mappings.py +9 -4
- openstackclient/tests/unit/identity/v3/test_trust.py +0 -2
- openstackclient/tests/unit/image/v1/fakes.py +2 -1
- openstackclient/tests/unit/image/v1/test_image.py +1 -1
- openstackclient/tests/unit/image/v2/fakes.py +82 -0
- openstackclient/tests/unit/image/v2/test_cache.py +214 -0
- openstackclient/tests/unit/image/v2/test_image.py +62 -4
- openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +5 -19
- openstackclient/tests/unit/image/v2/test_metadef_objects.py +162 -0
- openstackclient/tests/unit/image/v2/test_metadef_properties.py +227 -0
- openstackclient/tests/unit/integ/cli/test_shell.py +0 -2
- openstackclient/tests/unit/network/test_common.py +3 -3
- openstackclient/tests/unit/network/v2/fakes.py +1 -0
- openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +1133 -0
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +5 -13
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -9
- openstackclient/tests/unit/network/v2/test_network.py +33 -0
- openstackclient/tests/unit/network/v2/test_network_compute.py +5 -11
- openstackclient/tests/unit/network/v2/test_network_trunk.py +6 -8
- openstackclient/tests/unit/network/v2/test_port.py +83 -38
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +7 -15
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +19 -27
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +3 -6
- openstackclient/tests/unit/network/v2/test_subnet.py +92 -0
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +11 -13
- openstackclient/tests/unit/test_shell.py +1 -7
- openstackclient/tests/unit/utils.py +10 -4
- openstackclient/tests/unit/volume/v1/fakes.py +7 -1
- openstackclient/tests/unit/volume/v1/test_qos_specs.py +2 -2
- openstackclient/tests/unit/volume/v1/test_service.py +1 -1
- openstackclient/tests/unit/volume/v1/test_transfer_request.py +2 -2
- openstackclient/tests/unit/volume/v1/test_type.py +2 -4
- openstackclient/tests/unit/volume/v1/test_volume.py +5 -7
- openstackclient/tests/unit/volume/v1/test_volume_backup.py +4 -4
- openstackclient/tests/unit/volume/v2/fakes.py +32 -12
- openstackclient/tests/unit/volume/v2/test_backup_record.py +1 -1
- openstackclient/tests/unit/volume/v2/test_consistency_group.py +4 -6
- openstackclient/tests/unit/volume/v2/test_consistency_group_snapshot.py +2 -4
- openstackclient/tests/unit/volume/v2/test_qos_specs.py +2 -2
- openstackclient/tests/unit/volume/v2/test_service.py +1 -1
- openstackclient/tests/unit/volume/v2/test_volume.py +78 -16
- openstackclient/tests/unit/volume/v2/test_volume_backend.py +10 -22
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +76 -89
- openstackclient/tests/unit/volume/v2/test_volume_host.py +1 -1
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +5 -7
- openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +4 -8
- openstackclient/tests/unit/volume/v2/test_volume_type.py +164 -24
- openstackclient/tests/unit/volume/v3/fakes.py +91 -15
- openstackclient/tests/unit/volume/v3/test_block_storage_cleanup.py +3 -7
- openstackclient/tests/unit/volume/v3/test_block_storage_cluster.py +11 -31
- openstackclient/tests/unit/volume/v3/test_block_storage_log_level.py +6 -16
- openstackclient/tests/unit/volume/v3/test_block_storage_manage.py +219 -157
- openstackclient/tests/unit/volume/v3/test_block_storage_resource_filter.py +32 -23
- openstackclient/tests/unit/volume/v3/test_volume.py +50 -48
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +17 -47
- openstackclient/tests/unit/volume/v3/test_volume_group.py +23 -65
- openstackclient/tests/unit/volume/v3/test_volume_group_snapshot.py +88 -77
- openstackclient/tests/unit/volume/v3/test_volume_group_type.py +14 -42
- openstackclient/tests/unit/volume/v3/test_volume_message.py +10 -28
- openstackclient/volume/v1/volume.py +2 -14
- openstackclient/volume/v2/volume.py +30 -15
- openstackclient/volume/v2/volume_backend.py +10 -18
- openstackclient/volume/v2/volume_backup.py +18 -15
- openstackclient/volume/v2/volume_snapshot.py +2 -12
- openstackclient/volume/v2/volume_type.py +211 -14
- openstackclient/volume/v3/block_storage_manage.py +72 -11
- openstackclient/volume/v3/block_storage_resource_filter.py +33 -11
- openstackclient/volume/v3/volume_attachment.py +2 -14
- openstackclient/volume/v3/volume_group_snapshot.py +27 -27
- openstackclient/volume/v3/volume_message.py +2 -13
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/AUTHORS +11 -0
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/METADATA +6 -5
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/RECORD +160 -151
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/entry_points.txt +23 -5
- python_openstackclient-6.5.0.dist-info/pbr.json +1 -0
- openstackclient/tests/unit/common/test_parseractions.py +0 -233
- python_openstackclient-6.3.0.dist-info/pbr.json +0 -1
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/top_level.txt +0 -0
|
@@ -10,7 +10,11 @@
|
|
|
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
|
from cinderclient import api_versions
|
|
16
|
+
from openstack import utils as sdk_utils
|
|
17
|
+
from osc_lib.cli import format_columns
|
|
14
18
|
from osc_lib import exceptions
|
|
15
19
|
|
|
16
20
|
from openstackclient.tests.unit.volume.v3 import fakes as volume_fakes
|
|
@@ -21,11 +25,22 @@ class TestBlockStorageResourceFilter(volume_fakes.TestVolume):
|
|
|
21
25
|
def setUp(self):
|
|
22
26
|
super().setUp()
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
patcher = mock.patch.object(
|
|
29
|
+
sdk_utils, 'supports_microversion', return_value=True
|
|
30
|
+
)
|
|
31
|
+
self.addCleanup(patcher.stop)
|
|
32
|
+
self.supports_microversion_mock = patcher.start()
|
|
33
|
+
self._set_mock_microversion(
|
|
34
|
+
self.app.client_manager.volume.api_version.get_string()
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def _set_mock_microversion(self, mock_v):
|
|
38
|
+
"""Set a specific microversion for the mock supports_microversion()."""
|
|
39
|
+
self.supports_microversion_mock.reset_mock(return_value=True)
|
|
40
|
+
self.supports_microversion_mock.side_effect = (
|
|
41
|
+
lambda _, v: api_versions.APIVersion(v)
|
|
42
|
+
<= api_versions.APIVersion(mock_v)
|
|
27
43
|
)
|
|
28
|
-
self.resource_filter_mock.reset_mock()
|
|
29
44
|
|
|
30
45
|
|
|
31
46
|
class TestBlockStorageResourceFilterList(TestBlockStorageResourceFilter):
|
|
@@ -35,7 +50,7 @@ class TestBlockStorageResourceFilterList(TestBlockStorageResourceFilter):
|
|
|
35
50
|
def setUp(self):
|
|
36
51
|
super().setUp()
|
|
37
52
|
|
|
38
|
-
self.
|
|
53
|
+
self.volume_sdk_client.resource_filters.return_value = (
|
|
39
54
|
self.fake_resource_filters
|
|
40
55
|
)
|
|
41
56
|
|
|
@@ -47,9 +62,7 @@ class TestBlockStorageResourceFilterList(TestBlockStorageResourceFilter):
|
|
|
47
62
|
)
|
|
48
63
|
|
|
49
64
|
def test_resource_filter_list(self):
|
|
50
|
-
self.
|
|
51
|
-
'3.33'
|
|
52
|
-
)
|
|
65
|
+
self._set_mock_microversion('3.33')
|
|
53
66
|
|
|
54
67
|
arglist = []
|
|
55
68
|
verifylist = []
|
|
@@ -59,7 +72,7 @@ class TestBlockStorageResourceFilterList(TestBlockStorageResourceFilter):
|
|
|
59
72
|
expected_data = tuple(
|
|
60
73
|
(
|
|
61
74
|
resource_filter.resource,
|
|
62
|
-
resource_filter.filters,
|
|
75
|
+
format_columns.ListColumn(resource_filter.filters),
|
|
63
76
|
)
|
|
64
77
|
for resource_filter in self.fake_resource_filters
|
|
65
78
|
)
|
|
@@ -69,12 +82,10 @@ class TestBlockStorageResourceFilterList(TestBlockStorageResourceFilter):
|
|
|
69
82
|
self.assertEqual(expected_data, tuple(data))
|
|
70
83
|
|
|
71
84
|
# checking if proper call was made to list clusters
|
|
72
|
-
self.
|
|
85
|
+
self.volume_sdk_client.resource_filters.assert_called_with()
|
|
73
86
|
|
|
74
87
|
def test_resource_filter_list_pre_v333(self):
|
|
75
|
-
self.
|
|
76
|
-
'3.32'
|
|
77
|
-
)
|
|
88
|
+
self._set_mock_microversion('3.32')
|
|
78
89
|
|
|
79
90
|
arglist = []
|
|
80
91
|
verifylist = []
|
|
@@ -95,7 +106,7 @@ class TestBlockStorageResourceFilterShow(TestBlockStorageResourceFilter):
|
|
|
95
106
|
def setUp(self):
|
|
96
107
|
super().setUp()
|
|
97
108
|
|
|
98
|
-
self.
|
|
109
|
+
self.volume_sdk_client.resource_filters.return_value = iter(
|
|
99
110
|
[self.fake_resource_filter]
|
|
100
111
|
)
|
|
101
112
|
|
|
@@ -107,9 +118,7 @@ class TestBlockStorageResourceFilterShow(TestBlockStorageResourceFilter):
|
|
|
107
118
|
)
|
|
108
119
|
|
|
109
120
|
def test_resource_filter_show(self):
|
|
110
|
-
self.
|
|
111
|
-
'3.33'
|
|
112
|
-
)
|
|
121
|
+
self._set_mock_microversion('3.33')
|
|
113
122
|
|
|
114
123
|
arglist = [
|
|
115
124
|
self.fake_resource_filter.resource,
|
|
@@ -119,10 +128,10 @@ class TestBlockStorageResourceFilterShow(TestBlockStorageResourceFilter):
|
|
|
119
128
|
]
|
|
120
129
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
121
130
|
|
|
122
|
-
expected_columns = ('
|
|
131
|
+
expected_columns = ('Resource', 'Filters')
|
|
123
132
|
expected_data = (
|
|
124
|
-
self.fake_resource_filter.filters,
|
|
125
133
|
self.fake_resource_filter.resource,
|
|
134
|
+
format_columns.ListColumn(self.fake_resource_filter.filters),
|
|
126
135
|
)
|
|
127
136
|
columns, data = self.cmd.take_action(parsed_args)
|
|
128
137
|
|
|
@@ -130,12 +139,12 @@ class TestBlockStorageResourceFilterShow(TestBlockStorageResourceFilter):
|
|
|
130
139
|
self.assertEqual(expected_data, data)
|
|
131
140
|
|
|
132
141
|
# checking if proper call was made to list clusters
|
|
133
|
-
self.
|
|
142
|
+
self.volume_sdk_client.resource_filters.assert_called_with(
|
|
143
|
+
resource='volume'
|
|
144
|
+
)
|
|
134
145
|
|
|
135
146
|
def test_resource_filter_show_pre_v333(self):
|
|
136
|
-
self.
|
|
137
|
-
'3.32'
|
|
138
|
-
)
|
|
147
|
+
self._set_mock_microversion('3.32')
|
|
139
148
|
|
|
140
149
|
arglist = [
|
|
141
150
|
self.fake_resource_filter.resource,
|
|
@@ -16,30 +16,29 @@ import copy
|
|
|
16
16
|
from unittest import mock
|
|
17
17
|
|
|
18
18
|
from cinderclient import api_versions
|
|
19
|
+
from openstack.block_storage.v3 import block_storage_summary as _summary
|
|
20
|
+
from openstack.block_storage.v3 import snapshot as _snapshot
|
|
21
|
+
from openstack.block_storage.v3 import volume as _volume
|
|
22
|
+
from openstack.test import fakes as sdk_fakes
|
|
19
23
|
from openstack import utils as sdk_utils
|
|
20
24
|
from osc_lib.cli import format_columns
|
|
21
25
|
from osc_lib import exceptions
|
|
22
26
|
|
|
23
|
-
from openstackclient.tests.unit.volume.
|
|
24
|
-
from openstackclient.tests.unit.volume.v3 import fakes as v3_fakes
|
|
27
|
+
from openstackclient.tests.unit.volume.v3 import fakes
|
|
25
28
|
from openstackclient.volume.v3 import volume
|
|
26
29
|
|
|
27
30
|
|
|
28
|
-
class BaseVolumeTest(
|
|
31
|
+
class BaseVolumeTest(fakes.TestVolume):
|
|
29
32
|
def setUp(self):
|
|
30
33
|
super().setUp()
|
|
31
34
|
|
|
32
|
-
self.app.client_manager.sdk_connection = mock.Mock()
|
|
33
|
-
self.app.client_manager.sdk_connection.volume = mock.Mock()
|
|
34
|
-
self.sdk_client = self.app.client_manager.sdk_connection.volume
|
|
35
|
-
|
|
36
35
|
patcher = mock.patch.object(
|
|
37
36
|
sdk_utils, 'supports_microversion', return_value=True
|
|
38
37
|
)
|
|
39
38
|
self.addCleanup(patcher.stop)
|
|
40
39
|
self.supports_microversion_mock = patcher.start()
|
|
41
40
|
self._set_mock_microversion(
|
|
42
|
-
self.
|
|
41
|
+
self.volume_client.api_version.get_string()
|
|
43
42
|
)
|
|
44
43
|
|
|
45
44
|
def _set_mock_microversion(self, mock_v):
|
|
@@ -60,12 +59,14 @@ class TestVolumeSummary(BaseVolumeTest):
|
|
|
60
59
|
def setUp(self):
|
|
61
60
|
super().setUp()
|
|
62
61
|
|
|
63
|
-
self.
|
|
64
|
-
self.
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
self.volume_a = sdk_fakes.generate_fake_resource(_volume.Volume)
|
|
63
|
+
self.volume_b = sdk_fakes.generate_fake_resource(_volume.Volume)
|
|
64
|
+
self.summary = sdk_fakes.generate_fake_resource(
|
|
65
|
+
_summary.BlockStorageSummary,
|
|
66
|
+
total_count=2,
|
|
67
|
+
total_size=self.volume_a.size + self.volume_b.size,
|
|
67
68
|
)
|
|
68
|
-
self.
|
|
69
|
+
self.volume_sdk_client.summary.return_value = self.summary
|
|
69
70
|
|
|
70
71
|
# Get the command object to test
|
|
71
72
|
self.cmd = volume.VolumeSummary(self.app, None)
|
|
@@ -82,11 +83,11 @@ class TestVolumeSummary(BaseVolumeTest):
|
|
|
82
83
|
|
|
83
84
|
columns, data = self.cmd.take_action(parsed_args)
|
|
84
85
|
|
|
85
|
-
self.
|
|
86
|
+
self.volume_sdk_client.summary.assert_called_once_with(True)
|
|
86
87
|
|
|
87
88
|
self.assertEqual(self.columns, columns)
|
|
88
89
|
|
|
89
|
-
datalist = (2, self.
|
|
90
|
+
datalist = (2, self.volume_a.size + self.volume_b.size)
|
|
90
91
|
self.assertCountEqual(datalist, tuple(data))
|
|
91
92
|
|
|
92
93
|
def test_volume_summary_pre_312(self):
|
|
@@ -108,11 +109,14 @@ class TestVolumeSummary(BaseVolumeTest):
|
|
|
108
109
|
def test_volume_summary_with_metadata(self):
|
|
109
110
|
self._set_mock_microversion('3.36')
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
metadata = {**self.volume_a.metadata, **self.volume_b.metadata}
|
|
113
|
+
self.summary = sdk_fakes.generate_fake_resource(
|
|
114
|
+
_summary.BlockStorageSummary,
|
|
115
|
+
total_count=2,
|
|
116
|
+
total_size=self.volume_a.size + self.volume_b.size,
|
|
117
|
+
metadata=metadata,
|
|
114
118
|
)
|
|
115
|
-
self.
|
|
119
|
+
self.volume_sdk_client.summary.return_value = self.summary
|
|
116
120
|
|
|
117
121
|
new_cols = copy.deepcopy(self.columns)
|
|
118
122
|
new_cols.extend(['Metadata'])
|
|
@@ -127,14 +131,14 @@ class TestVolumeSummary(BaseVolumeTest):
|
|
|
127
131
|
|
|
128
132
|
columns, data = self.cmd.take_action(parsed_args)
|
|
129
133
|
|
|
130
|
-
self.
|
|
134
|
+
self.volume_sdk_client.summary.assert_called_once_with(True)
|
|
131
135
|
|
|
132
136
|
self.assertEqual(new_cols, columns)
|
|
133
137
|
|
|
134
138
|
datalist = (
|
|
135
139
|
2,
|
|
136
|
-
self.
|
|
137
|
-
format_columns.DictColumn(
|
|
140
|
+
self.volume_a.size + self.volume_b.size,
|
|
141
|
+
format_columns.DictColumn(metadata),
|
|
138
142
|
)
|
|
139
143
|
self.assertCountEqual(datalist, tuple(data))
|
|
140
144
|
|
|
@@ -143,20 +147,23 @@ class TestVolumeRevertToSnapshot(BaseVolumeTest):
|
|
|
143
147
|
def setUp(self):
|
|
144
148
|
super().setUp()
|
|
145
149
|
|
|
146
|
-
self.
|
|
147
|
-
self.
|
|
148
|
-
|
|
150
|
+
self.volume = sdk_fakes.generate_fake_resource(_volume.Volume)
|
|
151
|
+
self.snapshot = sdk_fakes.generate_fake_resource(
|
|
152
|
+
_snapshot.Snapshot,
|
|
153
|
+
volume_id=self.volume.id,
|
|
149
154
|
)
|
|
155
|
+
self.volume_sdk_client.find_volume.return_value = self.volume
|
|
156
|
+
self.volume_sdk_client.find_snapshot.return_value = self.snapshot
|
|
150
157
|
|
|
151
158
|
# Get the command object to test
|
|
152
159
|
self.cmd = volume.VolumeRevertToSnapshot(self.app, None)
|
|
153
160
|
|
|
154
161
|
def test_volume_revert_to_snapshot_pre_340(self):
|
|
155
162
|
arglist = [
|
|
156
|
-
self.
|
|
163
|
+
self.snapshot.id,
|
|
157
164
|
]
|
|
158
165
|
verifylist = [
|
|
159
|
-
('snapshot', self.
|
|
166
|
+
('snapshot', self.snapshot.id),
|
|
160
167
|
]
|
|
161
168
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
162
169
|
|
|
@@ -170,29 +177,24 @@ class TestVolumeRevertToSnapshot(BaseVolumeTest):
|
|
|
170
177
|
def test_volume_revert_to_snapshot(self):
|
|
171
178
|
self._set_mock_microversion('3.40')
|
|
172
179
|
arglist = [
|
|
173
|
-
self.
|
|
180
|
+
self.snapshot.id,
|
|
174
181
|
]
|
|
175
182
|
verifylist = [
|
|
176
|
-
('snapshot', self.
|
|
183
|
+
('snapshot', self.snapshot.id),
|
|
177
184
|
]
|
|
178
185
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
179
186
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
self.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
self.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
self.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
)
|
|
195
|
-
self.sdk_client.find_snapshot.assert_called_with(
|
|
196
|
-
self.mock_snapshot.id,
|
|
197
|
-
ignore_missing=False,
|
|
198
|
-
)
|
|
187
|
+
self.cmd.take_action(parsed_args)
|
|
188
|
+
|
|
189
|
+
self.volume_sdk_client.revert_volume_to_snapshot.assert_called_once_with(
|
|
190
|
+
self.volume,
|
|
191
|
+
self.snapshot,
|
|
192
|
+
)
|
|
193
|
+
self.volume_sdk_client.find_volume.assert_called_with(
|
|
194
|
+
self.volume.id,
|
|
195
|
+
ignore_missing=False,
|
|
196
|
+
)
|
|
197
|
+
self.volume_sdk_client.find_snapshot.assert_called_with(
|
|
198
|
+
self.snapshot.id,
|
|
199
|
+
ignore_missing=False,
|
|
200
|
+
)
|
|
@@ -24,18 +24,16 @@ class TestVolumeAttachment(volume_fakes.TestVolume):
|
|
|
24
24
|
def setUp(self):
|
|
25
25
|
super().setUp()
|
|
26
26
|
|
|
27
|
-
self.volumes_mock = self.
|
|
27
|
+
self.volumes_mock = self.volume_client.volumes
|
|
28
28
|
self.volumes_mock.reset_mock()
|
|
29
29
|
|
|
30
|
-
self.volume_attachments_mock =
|
|
31
|
-
self.app.client_manager.volume.attachments
|
|
32
|
-
)
|
|
30
|
+
self.volume_attachments_mock = self.volume_client.attachments
|
|
33
31
|
self.volume_attachments_mock.reset_mock()
|
|
34
32
|
|
|
35
33
|
self.projects_mock = self.app.client_manager.identity.projects
|
|
36
34
|
self.projects_mock.reset_mock()
|
|
37
35
|
|
|
38
|
-
self.servers_mock = self.
|
|
36
|
+
self.servers_mock = self.compute_client.servers
|
|
39
37
|
self.servers_mock.reset_mock()
|
|
40
38
|
|
|
41
39
|
|
|
@@ -80,9 +78,7 @@ class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
|
|
80
78
|
self.cmd = volume_attachment.CreateVolumeAttachment(self.app, None)
|
|
81
79
|
|
|
82
80
|
def test_volume_attachment_create(self):
|
|
83
|
-
self.
|
|
84
|
-
'3.27'
|
|
85
|
-
)
|
|
81
|
+
self.volume_client.api_version = api_versions.APIVersion('3.27')
|
|
86
82
|
|
|
87
83
|
arglist = [
|
|
88
84
|
self.volume.id,
|
|
@@ -117,9 +113,7 @@ class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
|
|
117
113
|
self.assertCountEqual(self.data, data)
|
|
118
114
|
|
|
119
115
|
def test_volume_attachment_create_with_connect(self):
|
|
120
|
-
self.
|
|
121
|
-
'3.54'
|
|
122
|
-
)
|
|
116
|
+
self.volume_client.api_version = api_versions.APIVersion('3.54')
|
|
123
117
|
|
|
124
118
|
arglist = [
|
|
125
119
|
self.volume.id,
|
|
@@ -182,9 +176,7 @@ class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
|
|
182
176
|
self.assertCountEqual(self.data, data)
|
|
183
177
|
|
|
184
178
|
def test_volume_attachment_create_pre_v327(self):
|
|
185
|
-
self.
|
|
186
|
-
'3.26'
|
|
187
|
-
)
|
|
179
|
+
self.volume_client.api_version = api_versions.APIVersion('3.26')
|
|
188
180
|
|
|
189
181
|
arglist = [
|
|
190
182
|
self.volume.id,
|
|
@@ -204,9 +196,7 @@ class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
|
|
204
196
|
)
|
|
205
197
|
|
|
206
198
|
def test_volume_attachment_create_with_mode_pre_v354(self):
|
|
207
|
-
self.
|
|
208
|
-
'3.53'
|
|
209
|
-
)
|
|
199
|
+
self.volume_client.api_version = api_versions.APIVersion('3.53')
|
|
210
200
|
|
|
211
201
|
arglist = [
|
|
212
202
|
self.volume.id,
|
|
@@ -229,9 +219,7 @@ class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
|
|
229
219
|
)
|
|
230
220
|
|
|
231
221
|
def test_volume_attachment_create_with_connect_missing_arg(self):
|
|
232
|
-
self.
|
|
233
|
-
'3.54'
|
|
234
|
-
)
|
|
222
|
+
self.volume_client.api_version = api_versions.APIVersion('3.54')
|
|
235
223
|
|
|
236
224
|
arglist = [
|
|
237
225
|
self.volume.id,
|
|
@@ -266,9 +254,7 @@ class TestVolumeAttachmentDelete(TestVolumeAttachment):
|
|
|
266
254
|
self.cmd = volume_attachment.DeleteVolumeAttachment(self.app, None)
|
|
267
255
|
|
|
268
256
|
def test_volume_attachment_delete(self):
|
|
269
|
-
self.
|
|
270
|
-
'3.27'
|
|
271
|
-
)
|
|
257
|
+
self.volume_client.api_version = api_versions.APIVersion('3.27')
|
|
272
258
|
|
|
273
259
|
arglist = [
|
|
274
260
|
self.volume_attachment.id,
|
|
@@ -286,9 +272,7 @@ class TestVolumeAttachmentDelete(TestVolumeAttachment):
|
|
|
286
272
|
self.assertIsNone(result)
|
|
287
273
|
|
|
288
274
|
def test_volume_attachment_delete_pre_v327(self):
|
|
289
|
-
self.
|
|
290
|
-
'3.26'
|
|
291
|
-
)
|
|
275
|
+
self.volume_client.api_version = api_versions.APIVersion('3.26')
|
|
292
276
|
|
|
293
277
|
arglist = [
|
|
294
278
|
self.volume_attachment.id,
|
|
@@ -340,9 +324,7 @@ class TestVolumeAttachmentSet(TestVolumeAttachment):
|
|
|
340
324
|
self.cmd = volume_attachment.SetVolumeAttachment(self.app, None)
|
|
341
325
|
|
|
342
326
|
def test_volume_attachment_set(self):
|
|
343
|
-
self.
|
|
344
|
-
'3.27'
|
|
345
|
-
)
|
|
327
|
+
self.volume_client.api_version = api_versions.APIVersion('3.27')
|
|
346
328
|
|
|
347
329
|
arglist = [
|
|
348
330
|
self.volume_attachment.id,
|
|
@@ -394,9 +376,7 @@ class TestVolumeAttachmentSet(TestVolumeAttachment):
|
|
|
394
376
|
self.assertCountEqual(self.data, data)
|
|
395
377
|
|
|
396
378
|
def test_volume_attachment_set_pre_v327(self):
|
|
397
|
-
self.
|
|
398
|
-
'3.26'
|
|
399
|
-
)
|
|
379
|
+
self.volume_client.api_version = api_versions.APIVersion('3.26')
|
|
400
380
|
|
|
401
381
|
arglist = [
|
|
402
382
|
self.volume_attachment.id,
|
|
@@ -428,9 +408,7 @@ class TestVolumeAttachmentComplete(TestVolumeAttachment):
|
|
|
428
408
|
self.cmd = volume_attachment.CompleteVolumeAttachment(self.app, None)
|
|
429
409
|
|
|
430
410
|
def test_volume_attachment_complete(self):
|
|
431
|
-
self.
|
|
432
|
-
'3.44'
|
|
433
|
-
)
|
|
411
|
+
self.volume_client.api_version = api_versions.APIVersion('3.44')
|
|
434
412
|
|
|
435
413
|
arglist = [
|
|
436
414
|
self.volume_attachment.id,
|
|
@@ -448,9 +426,7 @@ class TestVolumeAttachmentComplete(TestVolumeAttachment):
|
|
|
448
426
|
self.assertIsNone(result)
|
|
449
427
|
|
|
450
428
|
def test_volume_attachment_complete_pre_v344(self):
|
|
451
|
-
self.
|
|
452
|
-
'3.43'
|
|
453
|
-
)
|
|
429
|
+
self.volume_client.api_version = api_versions.APIVersion('3.43')
|
|
454
430
|
|
|
455
431
|
arglist = [
|
|
456
432
|
self.volume_attachment.id,
|
|
@@ -499,9 +475,7 @@ class TestVolumeAttachmentList(TestVolumeAttachment):
|
|
|
499
475
|
self.cmd = volume_attachment.ListVolumeAttachment(self.app, None)
|
|
500
476
|
|
|
501
477
|
def test_volume_attachment_list(self):
|
|
502
|
-
self.
|
|
503
|
-
'3.27'
|
|
504
|
-
)
|
|
478
|
+
self.volume_client.api_version = api_versions.APIVersion('3.27')
|
|
505
479
|
|
|
506
480
|
arglist = []
|
|
507
481
|
verifylist = [
|
|
@@ -530,9 +504,7 @@ class TestVolumeAttachmentList(TestVolumeAttachment):
|
|
|
530
504
|
self.assertCountEqual(tuple(self.data), data)
|
|
531
505
|
|
|
532
506
|
def test_volume_attachment_list_with_options(self):
|
|
533
|
-
self.
|
|
534
|
-
'3.27'
|
|
535
|
-
)
|
|
507
|
+
self.volume_client.api_version = api_versions.APIVersion('3.27')
|
|
536
508
|
|
|
537
509
|
arglist = [
|
|
538
510
|
'--project',
|
|
@@ -572,9 +544,7 @@ class TestVolumeAttachmentList(TestVolumeAttachment):
|
|
|
572
544
|
self.assertCountEqual(tuple(self.data), data)
|
|
573
545
|
|
|
574
546
|
def test_volume_attachment_list_pre_v327(self):
|
|
575
|
-
self.
|
|
576
|
-
'3.26'
|
|
577
|
-
)
|
|
547
|
+
self.volume_client.api_version = api_versions.APIVersion('3.26')
|
|
578
548
|
|
|
579
549
|
arglist = []
|
|
580
550
|
verifylist = [
|