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
|
@@ -27,13 +27,13 @@ class TestBackupLegacy(volume_fakes.TestVolume):
|
|
|
27
27
|
def setUp(self):
|
|
28
28
|
super().setUp()
|
|
29
29
|
|
|
30
|
-
self.backups_mock = self.
|
|
30
|
+
self.backups_mock = self.volume_client.backups
|
|
31
31
|
self.backups_mock.reset_mock()
|
|
32
|
-
self.volumes_mock = self.
|
|
32
|
+
self.volumes_mock = self.volume_client.volumes
|
|
33
33
|
self.volumes_mock.reset_mock()
|
|
34
|
-
self.snapshots_mock = self.
|
|
34
|
+
self.snapshots_mock = self.volume_client.volume_snapshots
|
|
35
35
|
self.snapshots_mock.reset_mock()
|
|
36
|
-
self.restores_mock = self.
|
|
36
|
+
self.restores_mock = self.volume_client.restores
|
|
37
37
|
self.restores_mock.reset_mock()
|
|
38
38
|
|
|
39
39
|
|
|
@@ -41,9 +41,6 @@ class TestBackup(volume_fakes.TestVolume):
|
|
|
41
41
|
def setUp(self):
|
|
42
42
|
super().setUp()
|
|
43
43
|
|
|
44
|
-
self.app.client_manager.sdk_connection = mock.Mock()
|
|
45
|
-
self.app.client_manager.sdk_connection.volume = mock.Mock()
|
|
46
|
-
self.sdk_client = self.app.client_manager.sdk_connection.volume
|
|
47
44
|
patcher = mock.patch.object(
|
|
48
45
|
sdk_utils, 'supports_microversion', return_value=True
|
|
49
46
|
)
|
|
@@ -83,9 +80,9 @@ class TestBackupCreate(TestBackup):
|
|
|
83
80
|
def setUp(self):
|
|
84
81
|
super().setUp()
|
|
85
82
|
|
|
86
|
-
self.
|
|
87
|
-
self.
|
|
88
|
-
self.
|
|
83
|
+
self.volume_sdk_client.find_volume.return_value = self.volume
|
|
84
|
+
self.volume_sdk_client.find_snapshot.return_value = self.snapshot
|
|
85
|
+
self.volume_sdk_client.create_backup.return_value = self.new_backup
|
|
89
86
|
|
|
90
87
|
# Get the command object to test
|
|
91
88
|
self.cmd = volume_backup.CreateVolumeBackup(self.app, None)
|
|
@@ -117,7 +114,7 @@ class TestBackupCreate(TestBackup):
|
|
|
117
114
|
|
|
118
115
|
columns, data = self.cmd.take_action(parsed_args)
|
|
119
116
|
|
|
120
|
-
self.
|
|
117
|
+
self.volume_sdk_client.create_backup.assert_called_with(
|
|
121
118
|
volume_id=self.new_backup.volume_id,
|
|
122
119
|
container=self.new_backup.container,
|
|
123
120
|
name=self.new_backup.name,
|
|
@@ -147,7 +144,7 @@ class TestBackupCreate(TestBackup):
|
|
|
147
144
|
|
|
148
145
|
columns, data = self.cmd.take_action(parsed_args)
|
|
149
146
|
|
|
150
|
-
self.
|
|
147
|
+
self.volume_sdk_client.create_backup.assert_called_with(
|
|
151
148
|
volume_id=self.new_backup.volume_id,
|
|
152
149
|
container=None,
|
|
153
150
|
name=None,
|
|
@@ -196,7 +193,7 @@ class TestBackupCreate(TestBackup):
|
|
|
196
193
|
|
|
197
194
|
columns, data = self.cmd.take_action(parsed_args)
|
|
198
195
|
|
|
199
|
-
self.
|
|
196
|
+
self.volume_sdk_client.create_backup.assert_called_with(
|
|
200
197
|
volume_id=self.new_backup.volume_id,
|
|
201
198
|
container=None,
|
|
202
199
|
name=None,
|
|
@@ -244,7 +241,7 @@ class TestBackupCreate(TestBackup):
|
|
|
244
241
|
|
|
245
242
|
columns, data = self.cmd.take_action(parsed_args)
|
|
246
243
|
|
|
247
|
-
self.
|
|
244
|
+
self.volume_sdk_client.create_backup.assert_called_with(
|
|
248
245
|
volume_id=self.new_backup.volume_id,
|
|
249
246
|
container=self.new_backup.container,
|
|
250
247
|
name=None,
|
|
@@ -262,8 +259,10 @@ class TestBackupDelete(TestBackup):
|
|
|
262
259
|
def setUp(self):
|
|
263
260
|
super().setUp()
|
|
264
261
|
|
|
265
|
-
self.
|
|
266
|
-
|
|
262
|
+
self.volume_sdk_client.find_backup = volume_fakes.get_backups(
|
|
263
|
+
self.backups
|
|
264
|
+
)
|
|
265
|
+
self.volume_sdk_client.delete_backup.return_value = None
|
|
267
266
|
|
|
268
267
|
# Get the command object to mock
|
|
269
268
|
self.cmd = volume_backup.DeleteVolumeBackup(self.app, None)
|
|
@@ -275,7 +274,7 @@ class TestBackupDelete(TestBackup):
|
|
|
275
274
|
|
|
276
275
|
result = self.cmd.take_action(parsed_args)
|
|
277
276
|
|
|
278
|
-
self.
|
|
277
|
+
self.volume_sdk_client.delete_backup.assert_called_with(
|
|
279
278
|
self.backups[0].id, ignore_missing=False, force=False
|
|
280
279
|
)
|
|
281
280
|
self.assertIsNone(result)
|
|
@@ -290,7 +289,7 @@ class TestBackupDelete(TestBackup):
|
|
|
290
289
|
|
|
291
290
|
result = self.cmd.take_action(parsed_args)
|
|
292
291
|
|
|
293
|
-
self.
|
|
292
|
+
self.volume_sdk_client.delete_backup.assert_called_with(
|
|
294
293
|
self.backups[0].id, ignore_missing=False, force=True
|
|
295
294
|
)
|
|
296
295
|
self.assertIsNone(result)
|
|
@@ -309,7 +308,7 @@ class TestBackupDelete(TestBackup):
|
|
|
309
308
|
calls = []
|
|
310
309
|
for b in self.backups:
|
|
311
310
|
calls.append(call(b.id, ignore_missing=False, force=False))
|
|
312
|
-
self.
|
|
311
|
+
self.volume_sdk_client.delete_backup.assert_has_calls(calls)
|
|
313
312
|
self.assertIsNone(result)
|
|
314
313
|
|
|
315
314
|
def test_delete_multiple_backups_with_exception(self):
|
|
@@ -324,24 +323,27 @@ class TestBackupDelete(TestBackup):
|
|
|
324
323
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
325
324
|
|
|
326
325
|
find_mock_result = [self.backups[0], exceptions.CommandError]
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
326
|
+
self.volume_sdk_client.find_backup.side_effect = find_mock_result
|
|
327
|
+
|
|
328
|
+
try:
|
|
329
|
+
self.cmd.take_action(parsed_args)
|
|
330
|
+
self.fail('CommandError should be raised.')
|
|
331
|
+
except exceptions.CommandError as e:
|
|
332
|
+
self.assertEqual('1 of 2 backups failed to delete.', str(e))
|
|
333
|
+
|
|
334
|
+
self.volume_sdk_client.find_backup.assert_any_call(
|
|
335
|
+
self.backups[0].id, ignore_missing=False
|
|
336
|
+
)
|
|
337
|
+
self.volume_sdk_client.find_backup.assert_any_call(
|
|
338
|
+
'unexist_backup', ignore_missing=False
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
self.assertEqual(2, self.volume_sdk_client.find_backup.call_count)
|
|
342
|
+
self.volume_sdk_client.delete_backup.assert_called_once_with(
|
|
343
|
+
self.backups[0].id,
|
|
344
|
+
ignore_missing=False,
|
|
345
|
+
force=False,
|
|
346
|
+
)
|
|
345
347
|
|
|
346
348
|
|
|
347
349
|
class TestBackupList(TestBackup):
|
|
@@ -356,6 +358,7 @@ class TestBackupList(TestBackup):
|
|
|
356
358
|
'Description',
|
|
357
359
|
'Status',
|
|
358
360
|
'Size',
|
|
361
|
+
'Incremental',
|
|
359
362
|
)
|
|
360
363
|
columns_long = columns + (
|
|
361
364
|
'Availability Zone',
|
|
@@ -372,6 +375,7 @@ class TestBackupList(TestBackup):
|
|
|
372
375
|
b.description,
|
|
373
376
|
b.status,
|
|
374
377
|
b.size,
|
|
378
|
+
b.is_incremental,
|
|
375
379
|
)
|
|
376
380
|
)
|
|
377
381
|
data_long = []
|
|
@@ -383,6 +387,7 @@ class TestBackupList(TestBackup):
|
|
|
383
387
|
b.description,
|
|
384
388
|
b.status,
|
|
385
389
|
b.size,
|
|
390
|
+
b.is_incremental,
|
|
386
391
|
b.availability_zone,
|
|
387
392
|
volume_backup.VolumeIdColumn(b.volume_id),
|
|
388
393
|
b.container,
|
|
@@ -392,10 +397,10 @@ class TestBackupList(TestBackup):
|
|
|
392
397
|
def setUp(self):
|
|
393
398
|
super().setUp()
|
|
394
399
|
|
|
395
|
-
self.
|
|
396
|
-
self.
|
|
397
|
-
self.
|
|
398
|
-
self.
|
|
400
|
+
self.volume_sdk_client.volumes.return_value = [self.volume]
|
|
401
|
+
self.volume_sdk_client.backups.return_value = self.backups
|
|
402
|
+
self.volume_sdk_client.find_volume.return_value = self.volume
|
|
403
|
+
self.volume_sdk_client.find_backup.return_value = self.backups[0]
|
|
399
404
|
|
|
400
405
|
# Get the command to test
|
|
401
406
|
self.cmd = volume_backup.ListVolumeBackup(self.app, None)
|
|
@@ -415,9 +420,9 @@ class TestBackupList(TestBackup):
|
|
|
415
420
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
416
421
|
columns, data = self.cmd.take_action(parsed_args)
|
|
417
422
|
|
|
418
|
-
self.
|
|
419
|
-
self.
|
|
420
|
-
self.
|
|
423
|
+
self.volume_sdk_client.find_volume.assert_not_called()
|
|
424
|
+
self.volume_sdk_client.find_backup.assert_not_called()
|
|
425
|
+
self.volume_sdk_client.backups.assert_called_with(
|
|
421
426
|
name=None,
|
|
422
427
|
status=None,
|
|
423
428
|
volume_id=None,
|
|
@@ -456,13 +461,13 @@ class TestBackupList(TestBackup):
|
|
|
456
461
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
457
462
|
columns, data = self.cmd.take_action(parsed_args)
|
|
458
463
|
|
|
459
|
-
self.
|
|
464
|
+
self.volume_sdk_client.find_volume.assert_called_once_with(
|
|
460
465
|
self.volume.id, ignore_missing=False
|
|
461
466
|
)
|
|
462
|
-
self.
|
|
467
|
+
self.volume_sdk_client.find_backup.assert_called_once_with(
|
|
463
468
|
self.backups[0].id, ignore_missing=False
|
|
464
469
|
)
|
|
465
|
-
self.
|
|
470
|
+
self.volume_sdk_client.backups.assert_called_with(
|
|
466
471
|
name=self.backups[0].name,
|
|
467
472
|
status="error",
|
|
468
473
|
volume_id=self.volume.id,
|
|
@@ -483,9 +488,9 @@ class TestBackupRestore(TestBackup):
|
|
|
483
488
|
def setUp(self):
|
|
484
489
|
super().setUp()
|
|
485
490
|
|
|
486
|
-
self.
|
|
487
|
-
self.
|
|
488
|
-
self.
|
|
491
|
+
self.volume_sdk_client.find_backup.return_value = self.backup
|
|
492
|
+
self.volume_sdk_client.find_volume.return_value = self.volume
|
|
493
|
+
self.volume_sdk_client.restore_backup.return_value = (
|
|
489
494
|
volume_fakes.create_one_volume(
|
|
490
495
|
{'id': self.volume['id']},
|
|
491
496
|
)
|
|
@@ -495,8 +500,9 @@ class TestBackupRestore(TestBackup):
|
|
|
495
500
|
self.cmd = volume_backup.RestoreVolumeBackup(self.app, None)
|
|
496
501
|
|
|
497
502
|
def test_backup_restore(self):
|
|
498
|
-
self.
|
|
499
|
-
|
|
503
|
+
self.volume_sdk_client.find_volume.side_effect = (
|
|
504
|
+
exceptions.CommandError()
|
|
505
|
+
)
|
|
500
506
|
arglist = [self.backup.id]
|
|
501
507
|
verifylist = [
|
|
502
508
|
("backup", self.backup.id),
|
|
@@ -505,7 +511,7 @@ class TestBackupRestore(TestBackup):
|
|
|
505
511
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
506
512
|
|
|
507
513
|
result = self.cmd.take_action(parsed_args)
|
|
508
|
-
self.
|
|
514
|
+
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
509
515
|
self.backup.id,
|
|
510
516
|
volume_id=None,
|
|
511
517
|
name=None,
|
|
@@ -513,8 +519,9 @@ class TestBackupRestore(TestBackup):
|
|
|
513
519
|
self.assertIsNotNone(result)
|
|
514
520
|
|
|
515
521
|
def test_backup_restore_with_volume(self):
|
|
516
|
-
self.
|
|
517
|
-
|
|
522
|
+
self.volume_sdk_client.find_volume.side_effect = (
|
|
523
|
+
exceptions.CommandError()
|
|
524
|
+
)
|
|
518
525
|
arglist = [
|
|
519
526
|
self.backup.id,
|
|
520
527
|
self.backup.volume_id,
|
|
@@ -526,7 +533,7 @@ class TestBackupRestore(TestBackup):
|
|
|
526
533
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
527
534
|
|
|
528
535
|
result = self.cmd.take_action(parsed_args)
|
|
529
|
-
self.
|
|
536
|
+
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
530
537
|
self.backup.id,
|
|
531
538
|
volume_id=None,
|
|
532
539
|
name=self.backup.volume_id,
|
|
@@ -547,7 +554,7 @@ class TestBackupRestore(TestBackup):
|
|
|
547
554
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
548
555
|
|
|
549
556
|
result = self.cmd.take_action(parsed_args)
|
|
550
|
-
self.
|
|
557
|
+
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
551
558
|
self.backup.id,
|
|
552
559
|
volume_id=self.volume.id,
|
|
553
560
|
name=None,
|
|
@@ -586,9 +593,7 @@ class TestBackupSet(TestBackupLegacy):
|
|
|
586
593
|
self.cmd = volume_backup.SetVolumeBackup(self.app, None)
|
|
587
594
|
|
|
588
595
|
def test_backup_set_name(self):
|
|
589
|
-
self.
|
|
590
|
-
'3.9'
|
|
591
|
-
)
|
|
596
|
+
self.volume_client.api_version = api_versions.APIVersion('3.9')
|
|
592
597
|
|
|
593
598
|
arglist = [
|
|
594
599
|
'--name',
|
|
@@ -610,9 +615,7 @@ class TestBackupSet(TestBackupLegacy):
|
|
|
610
615
|
self.assertIsNone(result)
|
|
611
616
|
|
|
612
617
|
def test_backup_set_name_pre_v39(self):
|
|
613
|
-
self.
|
|
614
|
-
'3.8'
|
|
615
|
-
)
|
|
618
|
+
self.volume_client.api_version = api_versions.APIVersion('3.8')
|
|
616
619
|
|
|
617
620
|
arglist = [
|
|
618
621
|
'--name',
|
|
@@ -631,9 +634,7 @@ class TestBackupSet(TestBackupLegacy):
|
|
|
631
634
|
self.assertIn("--os-volume-api-version 3.9 or greater", str(exc))
|
|
632
635
|
|
|
633
636
|
def test_backup_set_description(self):
|
|
634
|
-
self.
|
|
635
|
-
'3.9'
|
|
636
|
-
)
|
|
637
|
+
self.volume_client.api_version = api_versions.APIVersion('3.9')
|
|
637
638
|
|
|
638
639
|
arglist = [
|
|
639
640
|
'--description',
|
|
@@ -657,9 +658,7 @@ class TestBackupSet(TestBackupLegacy):
|
|
|
657
658
|
self.assertIsNone(result)
|
|
658
659
|
|
|
659
660
|
def test_backup_set_description_pre_v39(self):
|
|
660
|
-
self.
|
|
661
|
-
'3.8'
|
|
662
|
-
)
|
|
661
|
+
self.volume_client.api_version = api_versions.APIVersion('3.8')
|
|
663
662
|
|
|
664
663
|
arglist = [
|
|
665
664
|
'--description',
|
|
@@ -708,9 +707,7 @@ class TestBackupSet(TestBackupLegacy):
|
|
|
708
707
|
)
|
|
709
708
|
|
|
710
709
|
def test_backup_set_no_property(self):
|
|
711
|
-
self.
|
|
712
|
-
'3.43'
|
|
713
|
-
)
|
|
710
|
+
self.volume_client.api_version = api_versions.APIVersion('3.43')
|
|
714
711
|
|
|
715
712
|
arglist = [
|
|
716
713
|
'--no-property',
|
|
@@ -734,9 +731,7 @@ class TestBackupSet(TestBackupLegacy):
|
|
|
734
731
|
self.assertIsNone(result)
|
|
735
732
|
|
|
736
733
|
def test_backup_set_no_property_pre_v343(self):
|
|
737
|
-
self.
|
|
738
|
-
'3.42'
|
|
739
|
-
)
|
|
734
|
+
self.volume_client.api_version = api_versions.APIVersion('3.42')
|
|
740
735
|
|
|
741
736
|
arglist = [
|
|
742
737
|
'--no-property',
|
|
@@ -754,9 +749,7 @@ class TestBackupSet(TestBackupLegacy):
|
|
|
754
749
|
self.assertIn("--os-volume-api-version 3.43 or greater", str(exc))
|
|
755
750
|
|
|
756
751
|
def test_backup_set_property(self):
|
|
757
|
-
self.
|
|
758
|
-
'3.43'
|
|
759
|
-
)
|
|
752
|
+
self.volume_client.api_version = api_versions.APIVersion('3.43')
|
|
760
753
|
|
|
761
754
|
arglist = [
|
|
762
755
|
'--property',
|
|
@@ -781,9 +774,7 @@ class TestBackupSet(TestBackupLegacy):
|
|
|
781
774
|
self.assertIsNone(result)
|
|
782
775
|
|
|
783
776
|
def test_backup_set_property_pre_v343(self):
|
|
784
|
-
self.
|
|
785
|
-
'3.42'
|
|
786
|
-
)
|
|
777
|
+
self.volume_client.api_version = api_versions.APIVersion('3.42')
|
|
787
778
|
|
|
788
779
|
arglist = [
|
|
789
780
|
'--property',
|
|
@@ -816,9 +807,7 @@ class TestBackupUnset(TestBackupLegacy):
|
|
|
816
807
|
self.cmd = volume_backup.UnsetVolumeBackup(self.app, None)
|
|
817
808
|
|
|
818
809
|
def test_backup_unset_property(self):
|
|
819
|
-
self.
|
|
820
|
-
'3.43'
|
|
821
|
-
)
|
|
810
|
+
self.volume_client.api_version = api_versions.APIVersion('3.43')
|
|
822
811
|
|
|
823
812
|
arglist = [
|
|
824
813
|
'--property',
|
|
@@ -843,9 +832,7 @@ class TestBackupUnset(TestBackupLegacy):
|
|
|
843
832
|
self.assertIsNone(result)
|
|
844
833
|
|
|
845
834
|
def test_backup_unset_property_pre_v343(self):
|
|
846
|
-
self.
|
|
847
|
-
'3.42'
|
|
848
|
-
)
|
|
835
|
+
self.volume_client.api_version = api_versions.APIVersion('3.42')
|
|
849
836
|
|
|
850
837
|
arglist = [
|
|
851
838
|
'--property',
|
|
@@ -915,7 +902,7 @@ class TestBackupShow(TestBackup):
|
|
|
915
902
|
def setUp(self):
|
|
916
903
|
super().setUp()
|
|
917
904
|
|
|
918
|
-
self.
|
|
905
|
+
self.volume_sdk_client.get_backup.return_value = self.backup
|
|
919
906
|
# Get the command object to test
|
|
920
907
|
self.cmd = volume_backup.ShowVolumeBackup(self.app, None)
|
|
921
908
|
|
|
@@ -925,7 +912,7 @@ class TestBackupShow(TestBackup):
|
|
|
925
912
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
926
913
|
|
|
927
914
|
columns, data = self.cmd.take_action(parsed_args)
|
|
928
|
-
self.
|
|
915
|
+
self.volume_sdk_client.get_backup.assert_called_with(self.backup.id)
|
|
929
916
|
|
|
930
917
|
self.assertEqual(self.columns, columns)
|
|
931
918
|
self.assertEqual(self.data, data)
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
11
11
|
# License for the specific language governing permissions and limitations
|
|
12
12
|
# under the License.
|
|
13
|
-
#
|
|
14
13
|
|
|
15
|
-
import argparse
|
|
16
14
|
from unittest import mock
|
|
17
15
|
|
|
18
16
|
from osc_lib.cli import format_columns
|
|
@@ -20,7 +18,7 @@ from osc_lib import exceptions
|
|
|
20
18
|
from osc_lib import utils
|
|
21
19
|
|
|
22
20
|
from openstackclient.tests.unit.identity.v3 import fakes as project_fakes
|
|
23
|
-
from openstackclient.tests.unit import utils as
|
|
21
|
+
from openstackclient.tests.unit import utils as test_utils
|
|
24
22
|
from openstackclient.tests.unit.volume.v2 import fakes as volume_fakes
|
|
25
23
|
from openstackclient.volume.v2 import volume_snapshot
|
|
26
24
|
|
|
@@ -29,9 +27,9 @@ class TestVolumeSnapshot(volume_fakes.TestVolume):
|
|
|
29
27
|
def setUp(self):
|
|
30
28
|
super().setUp()
|
|
31
29
|
|
|
32
|
-
self.snapshots_mock = self.
|
|
30
|
+
self.snapshots_mock = self.volume_client.volume_snapshots
|
|
33
31
|
self.snapshots_mock.reset_mock()
|
|
34
|
-
self.volumes_mock = self.
|
|
32
|
+
self.volumes_mock = self.volume_client.volumes
|
|
35
33
|
self.volumes_mock.reset_mock()
|
|
36
34
|
self.project_mock = self.app.client_manager.identity.projects
|
|
37
35
|
self.project_mock.reset_mock()
|
|
@@ -117,7 +115,7 @@ class TestVolumeSnapshotCreate(TestVolumeSnapshot):
|
|
|
117
115
|
("volume", self.new_snapshot.volume_id),
|
|
118
116
|
]
|
|
119
117
|
self.assertRaises(
|
|
120
|
-
|
|
118
|
+
test_utils.ParserException,
|
|
121
119
|
self.check_parser,
|
|
122
120
|
self.cmd,
|
|
123
121
|
arglist,
|
|
@@ -491,7 +489,7 @@ class TestVolumeSnapshotList(TestVolumeSnapshot):
|
|
|
491
489
|
("limit", -2),
|
|
492
490
|
]
|
|
493
491
|
self.assertRaises(
|
|
494
|
-
|
|
492
|
+
test_utils.ParserException,
|
|
495
493
|
self.check_parser,
|
|
496
494
|
self.cmd,
|
|
497
495
|
arglist,
|
|
@@ -29,11 +29,11 @@ class TestTransfer(volume_fakes.TestVolume):
|
|
|
29
29
|
super().setUp()
|
|
30
30
|
|
|
31
31
|
# Get a shortcut to the TransferManager Mock
|
|
32
|
-
self.transfer_mock = self.
|
|
32
|
+
self.transfer_mock = self.volume_client.transfers
|
|
33
33
|
self.transfer_mock.reset_mock()
|
|
34
34
|
|
|
35
35
|
# Get a shortcut to the VolumeManager Mock
|
|
36
|
-
self.volumes_mock = self.
|
|
36
|
+
self.volumes_mock = self.volume_client.volumes
|
|
37
37
|
self.volumes_mock.reset_mock()
|
|
38
38
|
|
|
39
39
|
|
|
@@ -177,9 +177,7 @@ class TestTransferCreate(TestTransfer):
|
|
|
177
177
|
self.assertEqual(self.data, data)
|
|
178
178
|
|
|
179
179
|
def test_transfer_create_with_no_snapshots(self):
|
|
180
|
-
self.
|
|
181
|
-
'3.55'
|
|
182
|
-
)
|
|
180
|
+
self.volume_client.api_version = api_versions.APIVersion('3.55')
|
|
183
181
|
|
|
184
182
|
arglist = [
|
|
185
183
|
'--no-snapshots',
|
|
@@ -201,9 +199,7 @@ class TestTransferCreate(TestTransfer):
|
|
|
201
199
|
self.assertEqual(self.data, data)
|
|
202
200
|
|
|
203
201
|
def test_transfer_create_pre_v355(self):
|
|
204
|
-
self.
|
|
205
|
-
'3.54'
|
|
206
|
-
)
|
|
202
|
+
self.volume_client.api_version = api_versions.APIVersion('3.54')
|
|
207
203
|
|
|
208
204
|
arglist = [
|
|
209
205
|
'--no-snapshots',
|