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
|
@@ -30,20 +30,6 @@ class TestFlavor(compute_fakes.TestComputev2):
|
|
|
30
30
|
def setUp(self):
|
|
31
31
|
super(TestFlavor, self).setUp()
|
|
32
32
|
|
|
33
|
-
# SDK mock
|
|
34
|
-
self.app.client_manager.sdk_connection = mock.Mock()
|
|
35
|
-
self.app.client_manager.sdk_connection.compute = mock.Mock()
|
|
36
|
-
self.sdk_client = self.app.client_manager.sdk_connection.compute
|
|
37
|
-
self.sdk_client.flavors = mock.Mock()
|
|
38
|
-
self.sdk_client.find_flavor = mock.Mock()
|
|
39
|
-
self.sdk_client.delete_flavor = mock.Mock()
|
|
40
|
-
self.sdk_client.update_flavor = mock.Mock()
|
|
41
|
-
self.sdk_client.flavor_add_tenant_access = mock.Mock()
|
|
42
|
-
self.sdk_client.flavor_remove_tenant_access = mock.Mock()
|
|
43
|
-
self.sdk_client.create_flavor_extra_specs = mock.Mock()
|
|
44
|
-
self.sdk_client.update_flavor_extra_specs_property = mock.Mock()
|
|
45
|
-
self.sdk_client.delete_flavor_extra_specs_property = mock.Mock()
|
|
46
|
-
|
|
47
33
|
self.projects_mock = self.app.client_manager.identity.projects
|
|
48
34
|
self.projects_mock.reset_mock()
|
|
49
35
|
|
|
@@ -101,7 +87,7 @@ class TestFlavorCreate(TestFlavor):
|
|
|
101
87
|
|
|
102
88
|
# Return a project
|
|
103
89
|
self.projects_mock.get.return_value = self.project
|
|
104
|
-
self.
|
|
90
|
+
self.compute_sdk_client.create_flavor.return_value = self.flavor
|
|
105
91
|
self.cmd = flavor.CreateFlavor(self.app, None)
|
|
106
92
|
|
|
107
93
|
def test_flavor_create_default_options(self):
|
|
@@ -124,7 +110,9 @@ class TestFlavorCreate(TestFlavor):
|
|
|
124
110
|
}
|
|
125
111
|
|
|
126
112
|
columns, data = self.cmd.take_action(parsed_args)
|
|
127
|
-
self.
|
|
113
|
+
self.compute_sdk_client.create_flavor.assert_called_once_with(
|
|
114
|
+
**default_args
|
|
115
|
+
)
|
|
128
116
|
|
|
129
117
|
self.assertEqual(self.columns, columns)
|
|
130
118
|
self.assertCountEqual(self.data, data)
|
|
@@ -191,8 +179,8 @@ class TestFlavorCreate(TestFlavor):
|
|
|
191
179
|
# convert expected data tuple to list to be able to modify it
|
|
192
180
|
cmp_data = list(self.data)
|
|
193
181
|
cmp_data[7] = format_columns.DictColumn(props)
|
|
194
|
-
self.
|
|
195
|
-
self.
|
|
182
|
+
self.compute_sdk_client.create_flavor.return_value = create_flavor
|
|
183
|
+
self.compute_sdk_client.create_flavor_extra_specs.return_value = (
|
|
196
184
|
expected_flavor
|
|
197
185
|
)
|
|
198
186
|
|
|
@@ -200,11 +188,13 @@ class TestFlavorCreate(TestFlavor):
|
|
|
200
188
|
sdk_utils, 'supports_microversion', return_value=True
|
|
201
189
|
):
|
|
202
190
|
columns, data = self.cmd.take_action(parsed_args)
|
|
203
|
-
self.
|
|
204
|
-
|
|
191
|
+
self.compute_sdk_client.create_flavor.assert_called_once_with(
|
|
192
|
+
**args
|
|
193
|
+
)
|
|
194
|
+
self.compute_sdk_client.create_flavor_extra_specs.assert_called_once_with(
|
|
205
195
|
create_flavor, props
|
|
206
196
|
)
|
|
207
|
-
self.
|
|
197
|
+
self.compute_sdk_client.get_flavor_access.assert_not_called()
|
|
208
198
|
|
|
209
199
|
self.assertEqual(self.columns, columns)
|
|
210
200
|
self.assertCountEqual(tuple(cmp_data), data)
|
|
@@ -277,8 +267,8 @@ class TestFlavorCreate(TestFlavor):
|
|
|
277
267
|
# convert expected data tuple to list to be able to modify it
|
|
278
268
|
cmp_data = list(self.data_private)
|
|
279
269
|
cmp_data[7] = format_columns.DictColumn(props)
|
|
280
|
-
self.
|
|
281
|
-
self.
|
|
270
|
+
self.compute_sdk_client.create_flavor.return_value = create_flavor
|
|
271
|
+
self.compute_sdk_client.create_flavor_extra_specs.return_value = (
|
|
282
272
|
expected_flavor
|
|
283
273
|
)
|
|
284
274
|
|
|
@@ -286,12 +276,12 @@ class TestFlavorCreate(TestFlavor):
|
|
|
286
276
|
sdk_utils, 'supports_microversion', return_value=True
|
|
287
277
|
):
|
|
288
278
|
columns, data = self.cmd.take_action(parsed_args)
|
|
289
|
-
self.
|
|
290
|
-
self.
|
|
279
|
+
self.compute_sdk_client.create_flavor.assert_called_once_with(**args)
|
|
280
|
+
self.compute_sdk_client.flavor_add_tenant_access.assert_called_with(
|
|
291
281
|
self.flavor.id,
|
|
292
282
|
self.project.id,
|
|
293
283
|
)
|
|
294
|
-
self.
|
|
284
|
+
self.compute_sdk_client.create_flavor_extra_specs.assert_called_with(
|
|
295
285
|
create_flavor, props
|
|
296
286
|
)
|
|
297
287
|
self.assertEqual(self.columns, columns)
|
|
@@ -376,7 +366,7 @@ class TestFlavorCreate(TestFlavor):
|
|
|
376
366
|
'description': 'fake description',
|
|
377
367
|
}
|
|
378
368
|
|
|
379
|
-
self.
|
|
369
|
+
self.compute_sdk_client.create_flavor.assert_called_once_with(**args)
|
|
380
370
|
|
|
381
371
|
self.assertEqual(self.columns, columns)
|
|
382
372
|
self.assertCountEqual(self.data_private, data)
|
|
@@ -415,7 +405,7 @@ class TestFlavorDelete(TestFlavor):
|
|
|
415
405
|
def setUp(self):
|
|
416
406
|
super(TestFlavorDelete, self).setUp()
|
|
417
407
|
|
|
418
|
-
self.
|
|
408
|
+
self.compute_sdk_client.delete_flavor.return_value = None
|
|
419
409
|
|
|
420
410
|
self.cmd = flavor.DeleteFlavor(self.app, None)
|
|
421
411
|
|
|
@@ -426,14 +416,16 @@ class TestFlavorDelete(TestFlavor):
|
|
|
426
416
|
]
|
|
427
417
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
428
418
|
|
|
429
|
-
self.
|
|
419
|
+
self.compute_sdk_client.find_flavor.return_value = self.flavors[0]
|
|
430
420
|
|
|
431
421
|
result = self.cmd.take_action(parsed_args)
|
|
432
422
|
|
|
433
|
-
self.
|
|
423
|
+
self.compute_sdk_client.find_flavor.assert_called_with(
|
|
434
424
|
self.flavors[0].id, ignore_missing=False
|
|
435
425
|
)
|
|
436
|
-
self.
|
|
426
|
+
self.compute_sdk_client.delete_flavor.assert_called_with(
|
|
427
|
+
self.flavors[0].id
|
|
428
|
+
)
|
|
437
429
|
self.assertIsNone(result)
|
|
438
430
|
|
|
439
431
|
def test_delete_multiple_flavors(self):
|
|
@@ -446,7 +438,7 @@ class TestFlavorDelete(TestFlavor):
|
|
|
446
438
|
|
|
447
439
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
448
440
|
|
|
449
|
-
self.
|
|
441
|
+
self.compute_sdk_client.find_flavor.side_effect = self.flavors
|
|
450
442
|
|
|
451
443
|
result = self.cmd.take_action(parsed_args)
|
|
452
444
|
|
|
@@ -454,8 +446,8 @@ class TestFlavorDelete(TestFlavor):
|
|
|
454
446
|
mock.call(i.id, ignore_missing=False) for i in self.flavors
|
|
455
447
|
]
|
|
456
448
|
delete_calls = [mock.call(i.id) for i in self.flavors]
|
|
457
|
-
self.
|
|
458
|
-
self.
|
|
449
|
+
self.compute_sdk_client.find_flavor.assert_has_calls(find_calls)
|
|
450
|
+
self.compute_sdk_client.delete_flavor.assert_has_calls(delete_calls)
|
|
459
451
|
self.assertIsNone(result)
|
|
460
452
|
|
|
461
453
|
def test_multi_flavors_delete_with_exception(self):
|
|
@@ -466,7 +458,7 @@ class TestFlavorDelete(TestFlavor):
|
|
|
466
458
|
verifylist = [('flavor', [self.flavors[0].id, 'unexist_flavor'])]
|
|
467
459
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
468
460
|
|
|
469
|
-
self.
|
|
461
|
+
self.compute_sdk_client.find_flavor.side_effect = [
|
|
470
462
|
self.flavors[0],
|
|
471
463
|
sdk_exceptions.ResourceNotFound,
|
|
472
464
|
]
|
|
@@ -482,8 +474,8 @@ class TestFlavorDelete(TestFlavor):
|
|
|
482
474
|
mock.call('unexist_flavor', ignore_missing=False),
|
|
483
475
|
]
|
|
484
476
|
delete_calls = [mock.call(self.flavors[0].id)]
|
|
485
|
-
self.
|
|
486
|
-
self.
|
|
477
|
+
self.compute_sdk_client.find_flavor.assert_has_calls(find_calls)
|
|
478
|
+
self.compute_sdk_client.delete_flavor.assert_has_calls(delete_calls)
|
|
487
479
|
|
|
488
480
|
|
|
489
481
|
class TestFlavorList(TestFlavor):
|
|
@@ -529,7 +521,7 @@ class TestFlavorList(TestFlavor):
|
|
|
529
521
|
[],
|
|
530
522
|
]
|
|
531
523
|
|
|
532
|
-
self.
|
|
524
|
+
self.compute_sdk_client.flavors = self.api_mock
|
|
533
525
|
|
|
534
526
|
# Get the command object to test
|
|
535
527
|
self.cmd = flavor.ListFlavor(self.app, None)
|
|
@@ -554,8 +546,8 @@ class TestFlavorList(TestFlavor):
|
|
|
554
546
|
'is_public': True,
|
|
555
547
|
}
|
|
556
548
|
|
|
557
|
-
self.
|
|
558
|
-
self.
|
|
549
|
+
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
|
550
|
+
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
|
559
551
|
|
|
560
552
|
self.assertEqual(self.columns, columns)
|
|
561
553
|
self.assertEqual(self.data, tuple(data))
|
|
@@ -580,8 +572,8 @@ class TestFlavorList(TestFlavor):
|
|
|
580
572
|
'is_public': None,
|
|
581
573
|
}
|
|
582
574
|
|
|
583
|
-
self.
|
|
584
|
-
self.
|
|
575
|
+
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
|
576
|
+
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
|
585
577
|
|
|
586
578
|
self.assertEqual(self.columns, columns)
|
|
587
579
|
self.assertEqual(self.data, tuple(data))
|
|
@@ -606,8 +598,8 @@ class TestFlavorList(TestFlavor):
|
|
|
606
598
|
'is_public': False,
|
|
607
599
|
}
|
|
608
600
|
|
|
609
|
-
self.
|
|
610
|
-
self.
|
|
601
|
+
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
|
602
|
+
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
|
611
603
|
|
|
612
604
|
self.assertEqual(self.columns, columns)
|
|
613
605
|
self.assertEqual(self.data, tuple(data))
|
|
@@ -632,8 +624,8 @@ class TestFlavorList(TestFlavor):
|
|
|
632
624
|
'is_public': True,
|
|
633
625
|
}
|
|
634
626
|
|
|
635
|
-
self.
|
|
636
|
-
self.
|
|
627
|
+
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
|
628
|
+
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
|
637
629
|
|
|
638
630
|
self.assertEqual(self.columns, columns)
|
|
639
631
|
self.assertEqual(self.data, tuple(data))
|
|
@@ -658,8 +650,8 @@ class TestFlavorList(TestFlavor):
|
|
|
658
650
|
'is_public': True,
|
|
659
651
|
}
|
|
660
652
|
|
|
661
|
-
self.
|
|
662
|
-
self.
|
|
653
|
+
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
|
654
|
+
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
|
663
655
|
|
|
664
656
|
self.assertEqual(self.columns_long, columns)
|
|
665
657
|
self.assertCountEqual(self.data_long, tuple(data))
|
|
@@ -691,8 +683,10 @@ class TestFlavorList(TestFlavor):
|
|
|
691
683
|
[],
|
|
692
684
|
]
|
|
693
685
|
|
|
694
|
-
self.
|
|
695
|
-
self.
|
|
686
|
+
self.compute_sdk_client.flavors = self.api_mock
|
|
687
|
+
self.compute_sdk_client.fetch_flavor_extra_specs = mock.Mock(
|
|
688
|
+
return_value=None
|
|
689
|
+
)
|
|
696
690
|
|
|
697
691
|
arglist = [
|
|
698
692
|
'--long',
|
|
@@ -713,8 +707,8 @@ class TestFlavorList(TestFlavor):
|
|
|
713
707
|
'is_public': True,
|
|
714
708
|
}
|
|
715
709
|
|
|
716
|
-
self.
|
|
717
|
-
self.
|
|
710
|
+
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
|
711
|
+
self.compute_sdk_client.fetch_flavor_extra_specs.assert_called_once_with(
|
|
718
712
|
flavor
|
|
719
713
|
)
|
|
720
714
|
|
|
@@ -747,15 +741,15 @@ class TestFlavorList(TestFlavor):
|
|
|
747
741
|
'min_ram': 2048,
|
|
748
742
|
}
|
|
749
743
|
|
|
750
|
-
self.
|
|
751
|
-
self.
|
|
744
|
+
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
|
745
|
+
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
|
752
746
|
|
|
753
747
|
self.assertEqual(self.columns, columns)
|
|
754
748
|
self.assertEqual(tuple(self.data), tuple(data))
|
|
755
749
|
|
|
756
750
|
|
|
757
751
|
class TestFlavorSet(TestFlavor):
|
|
758
|
-
# Return value of self.
|
|
752
|
+
# Return value of self.compute_sdk_client.find_flavor().
|
|
759
753
|
flavor = compute_fakes.create_one_flavor(
|
|
760
754
|
attrs={'os-flavor-access:is_public': False}
|
|
761
755
|
)
|
|
@@ -764,7 +758,7 @@ class TestFlavorSet(TestFlavor):
|
|
|
764
758
|
def setUp(self):
|
|
765
759
|
super(TestFlavorSet, self).setUp()
|
|
766
760
|
|
|
767
|
-
self.
|
|
761
|
+
self.compute_sdk_client.find_flavor.return_value = self.flavor
|
|
768
762
|
# Return a project
|
|
769
763
|
self.projects_mock.get.return_value = self.project
|
|
770
764
|
self.cmd = flavor.SetFlavor(self.app, None)
|
|
@@ -778,10 +772,10 @@ class TestFlavorSet(TestFlavor):
|
|
|
778
772
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
779
773
|
|
|
780
774
|
result = self.cmd.take_action(parsed_args)
|
|
781
|
-
self.
|
|
775
|
+
self.compute_sdk_client.find_flavor.assert_called_with(
|
|
782
776
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
783
777
|
)
|
|
784
|
-
self.
|
|
778
|
+
self.compute_sdk_client.create_flavor_extra_specs.assert_called_with(
|
|
785
779
|
self.flavor.id, {'FOO': '"B A R"'}
|
|
786
780
|
)
|
|
787
781
|
self.assertIsNone(result)
|
|
@@ -792,10 +786,10 @@ class TestFlavorSet(TestFlavor):
|
|
|
792
786
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
793
787
|
|
|
794
788
|
result = self.cmd.take_action(parsed_args)
|
|
795
|
-
self.
|
|
789
|
+
self.compute_sdk_client.find_flavor.assert_called_with(
|
|
796
790
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
797
791
|
)
|
|
798
|
-
self.
|
|
792
|
+
self.compute_sdk_client.delete_flavor_extra_specs_property.assert_called_with(
|
|
799
793
|
self.flavor.id, 'property'
|
|
800
794
|
)
|
|
801
795
|
self.assertIsNone(result)
|
|
@@ -814,14 +808,14 @@ class TestFlavorSet(TestFlavor):
|
|
|
814
808
|
|
|
815
809
|
result = self.cmd.take_action(parsed_args)
|
|
816
810
|
|
|
817
|
-
self.
|
|
811
|
+
self.compute_sdk_client.find_flavor.assert_called_with(
|
|
818
812
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
819
813
|
)
|
|
820
|
-
self.
|
|
814
|
+
self.compute_sdk_client.flavor_add_tenant_access.assert_called_with(
|
|
821
815
|
self.flavor.id,
|
|
822
816
|
self.project.id,
|
|
823
817
|
)
|
|
824
|
-
self.
|
|
818
|
+
self.compute_sdk_client.create_flavor_extra_specs.assert_not_called()
|
|
825
819
|
self.assertIsNone(result)
|
|
826
820
|
|
|
827
821
|
def test_flavor_set_no_project(self):
|
|
@@ -858,7 +852,7 @@ class TestFlavorSet(TestFlavor):
|
|
|
858
852
|
)
|
|
859
853
|
|
|
860
854
|
def test_flavor_set_with_unexist_flavor(self):
|
|
861
|
-
self.
|
|
855
|
+
self.compute_sdk_client.find_flavor.side_effect = [
|
|
862
856
|
sdk_exceptions.ResourceNotFound()
|
|
863
857
|
]
|
|
864
858
|
|
|
@@ -887,10 +881,10 @@ class TestFlavorSet(TestFlavor):
|
|
|
887
881
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
888
882
|
result = self.cmd.take_action(parsed_args)
|
|
889
883
|
|
|
890
|
-
self.
|
|
884
|
+
self.compute_sdk_client.find_flavor.assert_called_with(
|
|
891
885
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
892
886
|
)
|
|
893
|
-
self.
|
|
887
|
+
self.compute_sdk_client.flavor_add_tenant_access.assert_not_called()
|
|
894
888
|
self.assertIsNone(result)
|
|
895
889
|
|
|
896
890
|
def test_flavor_set_description_api_newer(self):
|
|
@@ -904,12 +898,12 @@ class TestFlavorSet(TestFlavor):
|
|
|
904
898
|
('flavor', self.flavor.id),
|
|
905
899
|
]
|
|
906
900
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
907
|
-
|
|
901
|
+
|
|
908
902
|
with mock.patch.object(
|
|
909
903
|
sdk_utils, 'supports_microversion', return_value=True
|
|
910
904
|
):
|
|
911
905
|
result = self.cmd.take_action(parsed_args)
|
|
912
|
-
self.
|
|
906
|
+
self.compute_sdk_client.update_flavor.assert_called_with(
|
|
913
907
|
flavor=self.flavor.id, description='description'
|
|
914
908
|
)
|
|
915
909
|
self.assertIsNone(result)
|
|
@@ -925,7 +919,7 @@ class TestFlavorSet(TestFlavor):
|
|
|
925
919
|
('flavor', self.flavor.id),
|
|
926
920
|
]
|
|
927
921
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
928
|
-
|
|
922
|
+
|
|
929
923
|
with mock.patch.object(
|
|
930
924
|
sdk_utils, 'supports_microversion', return_value=False
|
|
931
925
|
):
|
|
@@ -944,13 +938,12 @@ class TestFlavorSet(TestFlavor):
|
|
|
944
938
|
('flavor', self.flavor.name),
|
|
945
939
|
]
|
|
946
940
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
947
|
-
self.app.client_manager.compute.api_version = 2.55
|
|
948
941
|
|
|
949
942
|
with mock.patch.object(
|
|
950
943
|
sdk_utils, 'supports_microversion', return_value=True
|
|
951
944
|
):
|
|
952
945
|
result = self.cmd.take_action(parsed_args)
|
|
953
|
-
self.
|
|
946
|
+
self.compute_sdk_client.update_flavor.assert_called_with(
|
|
954
947
|
flavor=self.flavor.id, description='description'
|
|
955
948
|
)
|
|
956
949
|
self.assertIsNone(result)
|
|
@@ -966,7 +959,6 @@ class TestFlavorSet(TestFlavor):
|
|
|
966
959
|
('flavor', self.flavor.name),
|
|
967
960
|
]
|
|
968
961
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
969
|
-
self.app.client_manager.compute.api_version = 2.54
|
|
970
962
|
|
|
971
963
|
with mock.patch.object(
|
|
972
964
|
sdk_utils, 'supports_microversion', return_value=False
|
|
@@ -977,7 +969,7 @@ class TestFlavorSet(TestFlavor):
|
|
|
977
969
|
|
|
978
970
|
|
|
979
971
|
class TestFlavorShow(TestFlavor):
|
|
980
|
-
# Return value of self.
|
|
972
|
+
# Return value of self.compute_sdk_client.find_flavor().
|
|
981
973
|
flavor_access = compute_fakes.create_one_flavor_access()
|
|
982
974
|
flavor = compute_fakes.create_one_flavor()
|
|
983
975
|
|
|
@@ -1017,8 +1009,10 @@ class TestFlavorShow(TestFlavor):
|
|
|
1017
1009
|
super(TestFlavorShow, self).setUp()
|
|
1018
1010
|
|
|
1019
1011
|
# Return value of _find_resource()
|
|
1020
|
-
self.
|
|
1021
|
-
self.
|
|
1012
|
+
self.compute_sdk_client.find_flavor.return_value = self.flavor
|
|
1013
|
+
self.compute_sdk_client.get_flavor_access.return_value = [
|
|
1014
|
+
self.flavor_access
|
|
1015
|
+
]
|
|
1022
1016
|
self.cmd = flavor.ShowFlavor(self.app, None)
|
|
1023
1017
|
|
|
1024
1018
|
def test_show_no_options(self):
|
|
@@ -1055,7 +1049,7 @@ class TestFlavorShow(TestFlavor):
|
|
|
1055
1049
|
'os-flavor-access:is_public': False,
|
|
1056
1050
|
}
|
|
1057
1051
|
)
|
|
1058
|
-
self.
|
|
1052
|
+
self.compute_sdk_client.find_flavor.return_value = private_flavor
|
|
1059
1053
|
|
|
1060
1054
|
arglist = [
|
|
1061
1055
|
private_flavor.name,
|
|
@@ -1084,7 +1078,7 @@ class TestFlavorShow(TestFlavor):
|
|
|
1084
1078
|
|
|
1085
1079
|
columns, data = self.cmd.take_action(parsed_args)
|
|
1086
1080
|
|
|
1087
|
-
self.
|
|
1081
|
+
self.compute_sdk_client.get_flavor_access.assert_called_with(
|
|
1088
1082
|
flavor=private_flavor.id
|
|
1089
1083
|
)
|
|
1090
1084
|
self.assertEqual(self.columns, columns)
|
|
@@ -1092,7 +1086,7 @@ class TestFlavorShow(TestFlavor):
|
|
|
1092
1086
|
|
|
1093
1087
|
|
|
1094
1088
|
class TestFlavorUnset(TestFlavor):
|
|
1095
|
-
# Return value of self.
|
|
1089
|
+
# Return value of self.compute_sdk_client.find_flavor().
|
|
1096
1090
|
flavor = compute_fakes.create_one_flavor(
|
|
1097
1091
|
attrs={'os-flavor-access:is_public': False}
|
|
1098
1092
|
)
|
|
@@ -1101,12 +1095,14 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1101
1095
|
def setUp(self):
|
|
1102
1096
|
super(TestFlavorUnset, self).setUp()
|
|
1103
1097
|
|
|
1104
|
-
self.
|
|
1098
|
+
self.compute_sdk_client.find_flavor.return_value = self.flavor
|
|
1105
1099
|
# Return a project
|
|
1106
1100
|
self.projects_mock.get.return_value = self.project
|
|
1107
1101
|
self.cmd = flavor.UnsetFlavor(self.app, None)
|
|
1108
1102
|
|
|
1109
|
-
self.mock_shortcut =
|
|
1103
|
+
self.mock_shortcut = (
|
|
1104
|
+
self.compute_sdk_client.delete_flavor_extra_specs_property
|
|
1105
|
+
)
|
|
1110
1106
|
|
|
1111
1107
|
def test_flavor_unset_property(self):
|
|
1112
1108
|
arglist = ['--property', 'property', 'baremetal']
|
|
@@ -1117,11 +1113,11 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1117
1113
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1118
1114
|
|
|
1119
1115
|
result = self.cmd.take_action(parsed_args)
|
|
1120
|
-
self.
|
|
1116
|
+
self.compute_sdk_client.find_flavor.assert_called_with(
|
|
1121
1117
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
1122
1118
|
)
|
|
1123
1119
|
self.mock_shortcut.assert_called_with(self.flavor.id, 'property')
|
|
1124
|
-
self.
|
|
1120
|
+
self.compute_sdk_client.flavor_remove_tenant_access.assert_not_called()
|
|
1125
1121
|
self.assertIsNone(result)
|
|
1126
1122
|
|
|
1127
1123
|
def test_flavor_unset_properties(self):
|
|
@@ -1139,7 +1135,7 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1139
1135
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1140
1136
|
|
|
1141
1137
|
self.cmd.take_action(parsed_args)
|
|
1142
|
-
self.
|
|
1138
|
+
self.compute_sdk_client.find_flavor.assert_called_with(
|
|
1143
1139
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
1144
1140
|
)
|
|
1145
1141
|
calls = [
|
|
@@ -1154,7 +1150,7 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1154
1150
|
AssertionError, self.mock_shortcut.assert_has_calls, calls
|
|
1155
1151
|
)
|
|
1156
1152
|
|
|
1157
|
-
self.
|
|
1153
|
+
self.compute_sdk_client.flavor_remove_tenant_access.assert_not_called()
|
|
1158
1154
|
|
|
1159
1155
|
def test_flavor_unset_project(self):
|
|
1160
1156
|
arglist = [
|
|
@@ -1171,14 +1167,14 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1171
1167
|
result = self.cmd.take_action(parsed_args)
|
|
1172
1168
|
self.assertIsNone(result)
|
|
1173
1169
|
|
|
1174
|
-
self.
|
|
1170
|
+
self.compute_sdk_client.find_flavor.assert_called_with(
|
|
1175
1171
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
1176
1172
|
)
|
|
1177
|
-
self.
|
|
1173
|
+
self.compute_sdk_client.flavor_remove_tenant_access.assert_called_with(
|
|
1178
1174
|
self.flavor.id,
|
|
1179
1175
|
self.project.id,
|
|
1180
1176
|
)
|
|
1181
|
-
self.
|
|
1177
|
+
self.compute_sdk_client.delete_flavor_extra_specs_property.assert_not_called()
|
|
1182
1178
|
self.assertIsNone(result)
|
|
1183
1179
|
|
|
1184
1180
|
def test_flavor_unset_no_project(self):
|
|
@@ -1215,7 +1211,7 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1215
1211
|
)
|
|
1216
1212
|
|
|
1217
1213
|
def test_flavor_unset_with_unexist_flavor(self):
|
|
1218
|
-
self.
|
|
1214
|
+
self.compute_sdk_client.find_flavor.side_effect = [
|
|
1219
1215
|
sdk_exceptions.ResourceNotFound
|
|
1220
1216
|
]
|
|
1221
1217
|
|
|
@@ -1245,4 +1241,4 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1245
1241
|
result = self.cmd.take_action(parsed_args)
|
|
1246
1242
|
self.assertIsNone(result)
|
|
1247
1243
|
|
|
1248
|
-
self.
|
|
1244
|
+
self.compute_sdk_client.flavor_remove_tenant_access.assert_not_called()
|
|
@@ -21,25 +21,14 @@ from openstackclient.tests.unit import fakes
|
|
|
21
21
|
from openstackclient.tests.unit import utils as tests_utils
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
class TestHost(compute_fakes.TestComputev2):
|
|
25
|
-
def setUp(self):
|
|
26
|
-
super(TestHost, self).setUp()
|
|
27
|
-
|
|
28
|
-
# Get a shortcut to the compute client
|
|
29
|
-
self.app.client_manager.sdk_connection = mock.Mock()
|
|
30
|
-
self.app.client_manager.sdk_connection.compute = mock.Mock()
|
|
31
|
-
self.sdk_client = self.app.client_manager.sdk_connection.compute
|
|
32
|
-
self.sdk_client.get = mock.Mock()
|
|
33
|
-
|
|
34
|
-
|
|
35
24
|
@mock.patch('openstackclient.api.compute_v2.APIv2.host_list')
|
|
36
|
-
class TestHostList(
|
|
25
|
+
class TestHostList(compute_fakes.TestComputev2):
|
|
37
26
|
_host = compute_fakes.create_one_host()
|
|
38
27
|
|
|
39
28
|
def setUp(self):
|
|
40
29
|
super(TestHostList, self).setUp()
|
|
41
30
|
|
|
42
|
-
self.
|
|
31
|
+
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
|
43
32
|
data={'hosts': [self._host]}
|
|
44
33
|
)
|
|
45
34
|
|
|
@@ -64,7 +53,9 @@ class TestHostList(TestHost):
|
|
|
64
53
|
|
|
65
54
|
columns, data = self.cmd.take_action(parsed_args)
|
|
66
55
|
|
|
67
|
-
self.
|
|
56
|
+
self.compute_sdk_client.get.assert_called_with(
|
|
57
|
+
'/os-hosts', microversion='2.1'
|
|
58
|
+
)
|
|
68
59
|
self.assertEqual(self.columns, columns)
|
|
69
60
|
self.assertEqual(self.data, list(data))
|
|
70
61
|
|
|
@@ -82,13 +73,15 @@ class TestHostList(TestHost):
|
|
|
82
73
|
|
|
83
74
|
columns, data = self.cmd.take_action(parsed_args)
|
|
84
75
|
|
|
85
|
-
self.
|
|
76
|
+
self.compute_sdk_client.get.assert_called_with(
|
|
77
|
+
'/os-hosts', microversion='2.1'
|
|
78
|
+
)
|
|
86
79
|
self.assertEqual(self.columns, columns)
|
|
87
80
|
self.assertEqual(self.data, list(data))
|
|
88
81
|
|
|
89
82
|
|
|
90
83
|
@mock.patch('openstackclient.api.compute_v2.APIv2.host_set')
|
|
91
|
-
class TestHostSet(
|
|
84
|
+
class TestHostSet(compute_fakes.TestComputev2):
|
|
92
85
|
def setUp(self):
|
|
93
86
|
super(TestHostSet, self).setUp()
|
|
94
87
|
|
|
@@ -138,7 +131,7 @@ class TestHostSet(TestHost):
|
|
|
138
131
|
|
|
139
132
|
|
|
140
133
|
@mock.patch('openstackclient.api.compute_v2.APIv2.host_show')
|
|
141
|
-
class TestHostShow(
|
|
134
|
+
class TestHostShow(compute_fakes.TestComputev2):
|
|
142
135
|
_host = compute_fakes.create_one_host()
|
|
143
136
|
|
|
144
137
|
def setUp(self):
|
|
@@ -154,7 +147,7 @@ class TestHostShow(TestHost):
|
|
|
154
147
|
}
|
|
155
148
|
}
|
|
156
149
|
|
|
157
|
-
self.
|
|
150
|
+
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
|
158
151
|
data={'host': [output_data]}
|
|
159
152
|
)
|
|
160
153
|
|
|
@@ -205,7 +198,7 @@ class TestHostShow(TestHost):
|
|
|
205
198
|
|
|
206
199
|
columns, data = self.cmd.take_action(parsed_args)
|
|
207
200
|
|
|
208
|
-
self.
|
|
201
|
+
self.compute_sdk_client.get.assert_called_with(
|
|
209
202
|
'/os-hosts/' + self._host['host_name'], microversion='2.1'
|
|
210
203
|
)
|
|
211
204
|
self.assertEqual(self.columns, columns)
|