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.
Files changed (162) hide show
  1. openstackclient/common/availability_zone.py +4 -4
  2. openstackclient/common/pagination.py +82 -0
  3. openstackclient/compute/v2/flavor.py +2 -16
  4. openstackclient/compute/v2/hypervisor.py +2 -21
  5. openstackclient/compute/v2/keypair.py +2 -9
  6. openstackclient/compute/v2/server.py +220 -131
  7. openstackclient/compute/v2/server_event.py +30 -19
  8. openstackclient/compute/v2/server_group.py +2 -23
  9. openstackclient/compute/v2/server_migration.py +2 -22
  10. openstackclient/compute/v2/usage.py +4 -6
  11. openstackclient/identity/v3/mapping.py +25 -3
  12. openstackclient/identity/v3/policy.py +3 -1
  13. openstackclient/image/v2/cache.py +218 -0
  14. openstackclient/image/v2/image.py +40 -17
  15. openstackclient/image/v2/metadef_namespaces.py +25 -21
  16. openstackclient/image/v2/metadef_objects.py +189 -0
  17. openstackclient/image/v2/metadef_properties.py +284 -0
  18. openstackclient/network/utils.py +100 -0
  19. openstackclient/network/v2/default_security_group_rule.py +418 -0
  20. openstackclient/network/v2/local_ip_association.py +1 -1
  21. openstackclient/network/v2/ndp_proxy.py +7 -3
  22. openstackclient/network/v2/network.py +2 -2
  23. openstackclient/network/v2/port.py +65 -19
  24. openstackclient/network/v2/security_group_rule.py +18 -111
  25. openstackclient/network/v2/subnet.py +1 -0
  26. openstackclient/object/v1/container.py +2 -12
  27. openstackclient/object/v1/object.py +2 -11
  28. openstackclient/tests/functional/base.py +13 -6
  29. openstackclient/tests/functional/identity/v3/test_role.py +11 -3
  30. openstackclient/tests/functional/network/v2/common.py +7 -1
  31. openstackclient/tests/functional/network/v2/test_address_group.py +2 -4
  32. openstackclient/tests/functional/network/v2/test_address_scope.py +0 -6
  33. openstackclient/tests/functional/network/v2/test_default_security_group_rule.py +67 -0
  34. openstackclient/tests/functional/network/v2/test_floating_ip.py +3 -6
  35. openstackclient/tests/functional/network/v2/test_ip_availability.py +3 -8
  36. openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +3 -4
  37. openstackclient/tests/functional/network/v2/test_local_ip.py +2 -4
  38. openstackclient/tests/functional/network/v2/test_network.py +18 -17
  39. openstackclient/tests/functional/network/v2/test_network_agent.py +24 -21
  40. openstackclient/tests/functional/network/v2/test_network_flavor.py +0 -6
  41. openstackclient/tests/functional/network/v2/test_network_flavor_profile.py +0 -6
  42. openstackclient/tests/functional/network/v2/test_network_meter.py +6 -6
  43. openstackclient/tests/functional/network/v2/test_network_meter_rule.py +7 -8
  44. openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +1 -3
  45. openstackclient/tests/functional/network/v2/test_network_qos_policy.py +4 -4
  46. openstackclient/tests/functional/network/v2/test_network_qos_rule.py +16 -20
  47. openstackclient/tests/functional/network/v2/test_network_qos_rule_type.py +4 -4
  48. openstackclient/tests/functional/network/v2/test_network_rbac.py +1 -4
  49. openstackclient/tests/functional/network/v2/test_network_segment.py +7 -12
  50. openstackclient/tests/functional/network/v2/test_network_segment_range.py +3 -4
  51. openstackclient/tests/functional/network/v2/test_network_service_provider.py +2 -4
  52. openstackclient/tests/functional/network/v2/test_network_trunk.py +3 -3
  53. openstackclient/tests/functional/network/v2/test_port.py +2 -8
  54. openstackclient/tests/functional/network/v2/test_router.py +0 -6
  55. openstackclient/tests/functional/network/v2/test_security_group.py +1 -4
  56. openstackclient/tests/functional/network/v2/test_security_group_rule.py +1 -4
  57. openstackclient/tests/functional/network/v2/test_subnet.py +4 -22
  58. openstackclient/tests/functional/network/v2/test_subnet_pool.py +0 -6
  59. openstackclient/tests/unit/common/test_availability_zone.py +28 -30
  60. openstackclient/tests/unit/common/test_extension.py +1 -4
  61. openstackclient/tests/unit/common/test_limits.py +2 -4
  62. openstackclient/tests/unit/common/test_project_cleanup.py +3 -10
  63. openstackclient/tests/unit/common/test_quota.py +18 -24
  64. openstackclient/tests/unit/compute/v2/fakes.py +24 -11
  65. openstackclient/tests/unit/compute/v2/test_agent.py +1 -1
  66. openstackclient/tests/unit/compute/v2/test_aggregate.py +62 -72
  67. openstackclient/tests/unit/compute/v2/test_console.py +18 -30
  68. openstackclient/tests/unit/compute/v2/test_flavor.py +85 -89
  69. openstackclient/tests/unit/compute/v2/test_host.py +12 -19
  70. openstackclient/tests/unit/compute/v2/test_hypervisor.py +23 -25
  71. openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -6
  72. openstackclient/tests/unit/compute/v2/test_keypair.py +25 -39
  73. openstackclient/tests/unit/compute/v2/test_server.py +316 -365
  74. openstackclient/tests/unit/compute/v2/test_server_backup.py +5 -17
  75. openstackclient/tests/unit/compute/v2/test_server_event.py +23 -25
  76. openstackclient/tests/unit/compute/v2/test_server_group.py +41 -33
  77. openstackclient/tests/unit/compute/v2/test_server_image.py +6 -18
  78. openstackclient/tests/unit/compute/v2/test_server_migration.py +45 -45
  79. openstackclient/tests/unit/compute/v2/test_server_volume.py +15 -31
  80. openstackclient/tests/unit/compute/v2/test_service.py +51 -56
  81. openstackclient/tests/unit/compute/v2/test_usage.py +10 -13
  82. openstackclient/tests/unit/fakes.py +4 -0
  83. openstackclient/tests/unit/identity/v3/test_mappings.py +9 -4
  84. openstackclient/tests/unit/identity/v3/test_trust.py +0 -2
  85. openstackclient/tests/unit/image/v1/fakes.py +2 -1
  86. openstackclient/tests/unit/image/v1/test_image.py +1 -1
  87. openstackclient/tests/unit/image/v2/fakes.py +82 -0
  88. openstackclient/tests/unit/image/v2/test_cache.py +214 -0
  89. openstackclient/tests/unit/image/v2/test_image.py +62 -4
  90. openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +5 -19
  91. openstackclient/tests/unit/image/v2/test_metadef_objects.py +162 -0
  92. openstackclient/tests/unit/image/v2/test_metadef_properties.py +227 -0
  93. openstackclient/tests/unit/integ/cli/test_shell.py +0 -2
  94. openstackclient/tests/unit/network/test_common.py +3 -3
  95. openstackclient/tests/unit/network/v2/fakes.py +1 -0
  96. openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +1133 -0
  97. openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +5 -13
  98. openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -9
  99. openstackclient/tests/unit/network/v2/test_network.py +33 -0
  100. openstackclient/tests/unit/network/v2/test_network_compute.py +5 -11
  101. openstackclient/tests/unit/network/v2/test_network_trunk.py +6 -8
  102. openstackclient/tests/unit/network/v2/test_port.py +83 -38
  103. openstackclient/tests/unit/network/v2/test_security_group_compute.py +7 -15
  104. openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +19 -27
  105. openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +3 -6
  106. openstackclient/tests/unit/network/v2/test_subnet.py +92 -0
  107. openstackclient/tests/unit/network/v2/test_subnet_pool.py +11 -13
  108. openstackclient/tests/unit/test_shell.py +1 -7
  109. openstackclient/tests/unit/utils.py +10 -4
  110. openstackclient/tests/unit/volume/v1/fakes.py +7 -1
  111. openstackclient/tests/unit/volume/v1/test_qos_specs.py +2 -2
  112. openstackclient/tests/unit/volume/v1/test_service.py +1 -1
  113. openstackclient/tests/unit/volume/v1/test_transfer_request.py +2 -2
  114. openstackclient/tests/unit/volume/v1/test_type.py +2 -4
  115. openstackclient/tests/unit/volume/v1/test_volume.py +5 -7
  116. openstackclient/tests/unit/volume/v1/test_volume_backup.py +4 -4
  117. openstackclient/tests/unit/volume/v2/fakes.py +32 -12
  118. openstackclient/tests/unit/volume/v2/test_backup_record.py +1 -1
  119. openstackclient/tests/unit/volume/v2/test_consistency_group.py +4 -6
  120. openstackclient/tests/unit/volume/v2/test_consistency_group_snapshot.py +2 -4
  121. openstackclient/tests/unit/volume/v2/test_qos_specs.py +2 -2
  122. openstackclient/tests/unit/volume/v2/test_service.py +1 -1
  123. openstackclient/tests/unit/volume/v2/test_volume.py +78 -16
  124. openstackclient/tests/unit/volume/v2/test_volume_backend.py +10 -22
  125. openstackclient/tests/unit/volume/v2/test_volume_backup.py +76 -89
  126. openstackclient/tests/unit/volume/v2/test_volume_host.py +1 -1
  127. openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +5 -7
  128. openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +4 -8
  129. openstackclient/tests/unit/volume/v2/test_volume_type.py +164 -24
  130. openstackclient/tests/unit/volume/v3/fakes.py +91 -15
  131. openstackclient/tests/unit/volume/v3/test_block_storage_cleanup.py +3 -7
  132. openstackclient/tests/unit/volume/v3/test_block_storage_cluster.py +11 -31
  133. openstackclient/tests/unit/volume/v3/test_block_storage_log_level.py +6 -16
  134. openstackclient/tests/unit/volume/v3/test_block_storage_manage.py +219 -157
  135. openstackclient/tests/unit/volume/v3/test_block_storage_resource_filter.py +32 -23
  136. openstackclient/tests/unit/volume/v3/test_volume.py +50 -48
  137. openstackclient/tests/unit/volume/v3/test_volume_attachment.py +17 -47
  138. openstackclient/tests/unit/volume/v3/test_volume_group.py +23 -65
  139. openstackclient/tests/unit/volume/v3/test_volume_group_snapshot.py +88 -77
  140. openstackclient/tests/unit/volume/v3/test_volume_group_type.py +14 -42
  141. openstackclient/tests/unit/volume/v3/test_volume_message.py +10 -28
  142. openstackclient/volume/v1/volume.py +2 -14
  143. openstackclient/volume/v2/volume.py +30 -15
  144. openstackclient/volume/v2/volume_backend.py +10 -18
  145. openstackclient/volume/v2/volume_backup.py +18 -15
  146. openstackclient/volume/v2/volume_snapshot.py +2 -12
  147. openstackclient/volume/v2/volume_type.py +211 -14
  148. openstackclient/volume/v3/block_storage_manage.py +72 -11
  149. openstackclient/volume/v3/block_storage_resource_filter.py +33 -11
  150. openstackclient/volume/v3/volume_attachment.py +2 -14
  151. openstackclient/volume/v3/volume_group_snapshot.py +27 -27
  152. openstackclient/volume/v3/volume_message.py +2 -13
  153. {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/AUTHORS +11 -0
  154. {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/METADATA +6 -5
  155. {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/RECORD +160 -151
  156. {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/entry_points.txt +23 -5
  157. python_openstackclient-6.5.0.dist-info/pbr.json +1 -0
  158. openstackclient/tests/unit/common/test_parseractions.py +0 -233
  159. python_openstackclient-6.3.0.dist-info/pbr.json +0 -1
  160. {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/LICENSE +0 -0
  161. {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/WHEEL +0 -0
  162. {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/top_level.txt +0 -0
@@ -17,9 +17,13 @@ import random
17
17
  from unittest import mock
18
18
  import uuid
19
19
 
20
+ # FIXME(stephenfin): We are using v3 resource versions despite being v2 fakes
20
21
  from cinderclient import api_versions
22
+ from openstack.block_storage.v2 import _proxy as block_storage_v2_proxy
21
23
  from openstack.block_storage.v3 import backup as _backup
22
- from openstack.block_storage.v3 import volume
24
+ from openstack.block_storage.v3 import capabilities as _capabilities
25
+ from openstack.block_storage.v3 import stats as _stats
26
+ from openstack.block_storage.v3 import volume as _volume
23
27
  from openstack.image.v2 import _proxy as image_v2_proxy
24
28
  from osc_lib.cli import format_columns
25
29
 
@@ -87,13 +91,26 @@ class FakeVolumeClient:
87
91
  self.volumes.resource_class = fakes.FakeResource(None, {})
88
92
 
89
93
 
90
- class TestVolume(utils.TestCommand):
94
+ class FakeClientMixin:
91
95
  def setUp(self):
92
96
  super().setUp()
93
97
 
94
98
  self.app.client_manager.volume = FakeVolumeClient(
95
99
  endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN
96
100
  )
101
+ self.volume_client = self.app.client_manager.volume
102
+
103
+ # TODO(stephenfin): Rename to 'volume_client' once all commands are
104
+ # migrated to SDK
105
+ self.app.client_manager.sdk_connection.volume = mock.Mock(
106
+ spec=block_storage_v2_proxy.Proxy,
107
+ )
108
+ self.volume_sdk_client = self.app.client_manager.sdk_connection.volume
109
+
110
+
111
+ class TestVolume(FakeClientMixin, utils.TestCommand):
112
+ def setUp(self):
113
+ super().setUp()
97
114
 
98
115
  self.app.client_manager.identity = identity_fakes.FakeIdentityv3Client(
99
116
  endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN
@@ -286,7 +303,7 @@ def create_one_capability(attrs=None):
286
303
  # Overwrite default attributes if there are some attributes set
287
304
  capability_info.update(attrs or {})
288
305
 
289
- capability = fakes.FakeResource(None, capability_info, loaded=True)
306
+ capability = _capabilities.Capabilities(**capability_info)
290
307
 
291
308
  return capability
292
309
 
@@ -302,19 +319,21 @@ def create_one_pool(attrs=None):
302
319
  # Set default attribute
303
320
  pool_info = {
304
321
  'name': 'host@lvmdriver-1#lvmdriver-1',
305
- 'storage_protocol': 'iSCSI',
306
- 'thick_provisioning_support': False,
307
- 'thin_provisioning_support': True,
308
- 'total_volumes': 99,
309
- 'total_capacity_gb': 1000.00,
310
- 'allocated_capacity_gb': 100,
311
- 'max_over_subscription_ratio': 200.0,
322
+ 'capabilities': {
323
+ 'storage_protocol': 'iSCSI',
324
+ 'thick_provisioning_support': False,
325
+ 'thin_provisioning_support': True,
326
+ 'total_volumes': 99,
327
+ 'total_capacity_gb': 1000.00,
328
+ 'allocated_capacity_gb': 100,
329
+ 'max_over_subscription_ratio': 200.0,
330
+ },
312
331
  }
313
332
 
314
333
  # Overwrite default attributes if there are some attributes set
315
334
  pool_info.update(attrs or {})
316
335
 
317
- pool = fakes.FakeResource(None, pool_info, loaded=True)
336
+ pool = _stats.Pools(**pool_info)
318
337
 
319
338
  return pool
320
339
 
@@ -413,7 +432,7 @@ def create_one_sdk_volume(attrs=None):
413
432
 
414
433
  # Overwrite default attributes if there are some attributes set
415
434
  volume_info.update(attrs)
416
- return volume.Volume(**volume_info)
435
+ return _volume.Volume(**volume_info)
417
436
 
418
437
 
419
438
  def create_sdk_volumes(attrs=None, count=2):
@@ -520,6 +539,7 @@ def create_one_backup(attrs=None):
520
539
  "object_count": None,
521
540
  "container": 'container-' + uuid.uuid4().hex,
522
541
  "size": random.randint(1, 20),
542
+ "is_incremental": False,
523
543
  "status": "error",
524
544
  "availability_zone": 'zone' + uuid.uuid4().hex,
525
545
  }
@@ -20,7 +20,7 @@ class TestBackupRecord(volume_fakes.TestVolume):
20
20
  def setUp(self):
21
21
  super().setUp()
22
22
 
23
- self.backups_mock = self.app.client_manager.volume.backups
23
+ self.backups_mock = self.volume_client.backups
24
24
  self.backups_mock.reset_mock()
25
25
 
26
26
 
@@ -28,18 +28,16 @@ class TestConsistencyGroup(volume_fakes.TestVolume):
28
28
  super().setUp()
29
29
 
30
30
  # Get a shortcut to the TransferManager Mock
31
- self.consistencygroups_mock = (
32
- self.app.client_manager.volume.consistencygroups
33
- )
31
+ self.consistencygroups_mock = self.volume_client.consistencygroups
34
32
  self.consistencygroups_mock.reset_mock()
35
33
 
36
- self.cgsnapshots_mock = self.app.client_manager.volume.cgsnapshots
34
+ self.cgsnapshots_mock = self.volume_client.cgsnapshots
37
35
  self.cgsnapshots_mock.reset_mock()
38
36
 
39
- self.volumes_mock = self.app.client_manager.volume.volumes
37
+ self.volumes_mock = self.volume_client.volumes
40
38
  self.volumes_mock.reset_mock()
41
39
 
42
- self.types_mock = self.app.client_manager.volume.volume_types
40
+ self.types_mock = self.volume_client.volume_types
43
41
  self.types_mock.reset_mock()
44
42
 
45
43
 
@@ -23,11 +23,9 @@ class TestConsistencyGroupSnapshot(volume_fakes.TestVolume):
23
23
  super(TestConsistencyGroupSnapshot, self).setUp()
24
24
 
25
25
  # Get a shortcut to the TransferManager Mock
26
- self.cgsnapshots_mock = self.app.client_manager.volume.cgsnapshots
26
+ self.cgsnapshots_mock = self.volume_client.cgsnapshots
27
27
  self.cgsnapshots_mock.reset_mock()
28
- self.consistencygroups_mock = (
29
- self.app.client_manager.volume.consistencygroups
30
- )
28
+ self.consistencygroups_mock = self.volume_client.consistencygroups
31
29
  self.consistencygroups_mock.reset_mock()
32
30
 
33
31
 
@@ -29,10 +29,10 @@ class TestQos(volume_fakes.TestVolume):
29
29
  def setUp(self):
30
30
  super(TestQos, self).setUp()
31
31
 
32
- self.qos_mock = self.app.client_manager.volume.qos_specs
32
+ self.qos_mock = self.volume_client.qos_specs
33
33
  self.qos_mock.reset_mock()
34
34
 
35
- self.types_mock = self.app.client_manager.volume.volume_types
35
+ self.types_mock = self.volume_client.volume_types
36
36
  self.types_mock.reset_mock()
37
37
 
38
38
 
@@ -23,7 +23,7 @@ class TestService(volume_fakes.TestVolume):
23
23
  super().setUp()
24
24
 
25
25
  # Get a shortcut to the ServiceManager Mock
26
- self.service_mock = self.app.client_manager.volume.services
26
+ self.service_mock = self.volume_client.services
27
27
  self.service_mock.reset_mock()
28
28
 
29
29
 
@@ -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
  from unittest.mock import call
18
16
 
@@ -23,7 +21,7 @@ from osc_lib import utils
23
21
 
24
22
  from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
25
23
  from openstackclient.tests.unit.image.v2 import fakes as image_fakes
26
- from openstackclient.tests.unit import utils as tests_utils
24
+ from openstackclient.tests.unit import utils as test_utils
27
25
  from openstackclient.tests.unit.volume.v2 import fakes as volume_fakes
28
26
  from openstackclient.volume.v2 import volume
29
27
 
@@ -32,7 +30,7 @@ class TestVolume(volume_fakes.TestVolume):
32
30
  def setUp(self):
33
31
  super().setUp()
34
32
 
35
- self.volumes_mock = self.app.client_manager.volume.volumes
33
+ self.volumes_mock = self.volume_client.volumes
36
34
  self.volumes_mock.reset_mock()
37
35
 
38
36
  self.projects_mock = self.app.client_manager.identity.projects
@@ -41,18 +39,16 @@ class TestVolume(volume_fakes.TestVolume):
41
39
  self.users_mock = self.app.client_manager.identity.users
42
40
  self.users_mock.reset_mock()
43
41
 
44
- self.snapshots_mock = self.app.client_manager.volume.volume_snapshots
42
+ self.snapshots_mock = self.volume_client.volume_snapshots
45
43
  self.snapshots_mock.reset_mock()
46
44
 
47
- self.backups_mock = self.app.client_manager.volume.backups
45
+ self.backups_mock = self.volume_client.backups
48
46
  self.backups_mock.reset_mock()
49
47
 
50
- self.types_mock = self.app.client_manager.volume.volume_types
48
+ self.types_mock = self.volume_client.volume_types
51
49
  self.types_mock.reset_mock()
52
50
 
53
- self.consistencygroups_mock = (
54
- self.app.client_manager.volume.consistencygroups
55
- )
51
+ self.consistencygroups_mock = self.volume_client.consistencygroups
56
52
  self.consistencygroups_mock.reset_mock()
57
53
 
58
54
  def setup_volumes_mock(self, count):
@@ -365,9 +361,7 @@ class TestVolumeCreate(TestVolume):
365
361
 
366
362
  self.backups_mock.get.return_value = backup
367
363
 
368
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
369
- '3.47'
370
- )
364
+ self.volume_client.api_version = api_versions.APIVersion('3.47')
371
365
 
372
366
  # In base command class ShowOne in cliff, abstract method take_action()
373
367
  # returns a two-part tuple with a tuple of column names and a tuple of
@@ -679,13 +673,81 @@ class TestVolumeCreate(TestVolume):
679
673
  ]
680
674
 
681
675
  self.assertRaises(
682
- tests_utils.ParserException,
676
+ test_utils.ParserException,
683
677
  self.check_parser,
684
678
  self.cmd,
685
679
  arglist,
686
680
  verifylist,
687
681
  )
688
682
 
683
+ def test_volume_create_hints(self):
684
+ """--hint needs to behave differently based on the given hint
685
+
686
+ different_host and same_host need to append to a list if given multiple
687
+ times. All other parameter are strings.
688
+ """
689
+ arglist = [
690
+ '--size',
691
+ str(self.new_volume.size),
692
+ '--hint',
693
+ 'k=v',
694
+ '--hint',
695
+ 'k=v2',
696
+ '--hint',
697
+ 'same_host=v3',
698
+ '--hint',
699
+ 'same_host=v4',
700
+ '--hint',
701
+ 'different_host=v5',
702
+ '--hint',
703
+ 'local_to_instance=v6',
704
+ '--hint',
705
+ 'different_host=v7',
706
+ self.new_volume.name,
707
+ ]
708
+ verifylist = [
709
+ ('size', self.new_volume.size),
710
+ (
711
+ 'hint',
712
+ {
713
+ 'k': 'v2',
714
+ 'same_host': ['v3', 'v4'],
715
+ 'local_to_instance': 'v6',
716
+ 'different_host': ['v5', 'v7'],
717
+ },
718
+ ),
719
+ ('name', self.new_volume.name),
720
+ ]
721
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
722
+
723
+ # In base command class ShowOne in cliff, abstract method take_action()
724
+ # returns a two-part tuple with a tuple of column names and a tuple of
725
+ # data to be shown.
726
+ columns, data = self.cmd.take_action(parsed_args)
727
+
728
+ self.volumes_mock.create.assert_called_with(
729
+ size=self.new_volume.size,
730
+ snapshot_id=None,
731
+ name=self.new_volume.name,
732
+ description=None,
733
+ volume_type=None,
734
+ availability_zone=None,
735
+ metadata=None,
736
+ imageRef=None,
737
+ source_volid=None,
738
+ consistencygroup_id=None,
739
+ scheduler_hints={
740
+ 'k': 'v2',
741
+ 'same_host': ['v3', 'v4'],
742
+ 'local_to_instance': 'v6',
743
+ 'different_host': ['v5', 'v7'],
744
+ },
745
+ backup_id=None,
746
+ )
747
+
748
+ self.assertEqual(self.columns, columns)
749
+ self.assertCountEqual(self.datalist, data)
750
+
689
751
 
690
752
  class TestVolumeDelete(TestVolume):
691
753
  def setUp(self):
@@ -1283,7 +1345,7 @@ class TestVolumeList(TestVolume):
1283
1345
  ("limit", -2),
1284
1346
  ]
1285
1347
  self.assertRaises(
1286
- argparse.ArgumentTypeError,
1348
+ test_utils.ParserException,
1287
1349
  self.check_parser,
1288
1350
  self.cmd,
1289
1351
  arglist,
@@ -1394,7 +1456,7 @@ class TestVolumeMigrate(TestVolume):
1394
1456
  ]
1395
1457
 
1396
1458
  self.assertRaises(
1397
- tests_utils.ParserException,
1459
+ test_utils.ParserException,
1398
1460
  self.check_parser,
1399
1461
  self.cmd,
1400
1462
  arglist,
@@ -12,6 +12,8 @@
12
12
  # under the License.
13
13
  #
14
14
 
15
+ from osc_lib.cli import format_columns
16
+
15
17
  from openstackclient.tests.unit.volume.v2 import fakes as volume_fakes
16
18
  from openstackclient.volume.v2 import volume_backend
17
19
 
@@ -25,9 +27,8 @@ class TestShowVolumeCapability(volume_fakes.TestVolume):
25
27
  def setUp(self):
26
28
  super().setUp()
27
29
 
28
- # Get a shortcut to the capability Mock
29
- self.capability_mock = self.app.client_manager.volume.capabilities
30
- self.capability_mock.get.return_value = self.capability
30
+ # Assign return value to capabilities mock
31
+ self.volume_sdk_client.get_capabilities.return_value = self.capability
31
32
 
32
33
  # Get the command object to test
33
34
  self.cmd = volume_backend.ShowCapability(self.app, None)
@@ -68,7 +69,7 @@ class TestShowVolumeCapability(volume_fakes.TestVolume):
68
69
  self.assertIn(cap[0], capabilities)
69
70
 
70
71
  # checking if proper call was made to get capabilities
71
- self.capability_mock.get.assert_called_with(
72
+ self.volume_sdk_client.get_capabilities.assert_called_with(
72
73
  'fake',
73
74
  )
74
75
 
@@ -82,8 +83,7 @@ class TestListVolumePool(volume_fakes.TestVolume):
82
83
  def setUp(self):
83
84
  super().setUp()
84
85
 
85
- self.pool_mock = self.app.client_manager.volume.pools
86
- self.pool_mock.list.return_value = [self.pools]
86
+ self.volume_sdk_client.backend_pools.return_value = [self.pools]
87
87
 
88
88
  # Get the command object to test
89
89
  self.cmd = volume_backend.ListPool(self.app, None)
@@ -111,7 +111,7 @@ class TestListVolumePool(volume_fakes.TestVolume):
111
111
  self.assertEqual(datalist, tuple(data))
112
112
 
113
113
  # checking if proper call was made to list pools
114
- self.pool_mock.list.assert_called_with(
114
+ self.volume_sdk_client.backend_pools.assert_called_with(
115
115
  detailed=False,
116
116
  )
117
117
 
@@ -131,13 +131,7 @@ class TestListVolumePool(volume_fakes.TestVolume):
131
131
 
132
132
  expected_columns = [
133
133
  'Name',
134
- 'Protocol',
135
- 'Thick',
136
- 'Thin',
137
- 'Volumes',
138
- 'Capacity',
139
- 'Allocated',
140
- 'Max Over Ratio',
134
+ 'Capabilities',
141
135
  ]
142
136
 
143
137
  # confirming if all expected columns are present in the result.
@@ -146,19 +140,13 @@ class TestListVolumePool(volume_fakes.TestVolume):
146
140
  datalist = (
147
141
  (
148
142
  self.pools.name,
149
- self.pools.storage_protocol,
150
- self.pools.thick_provisioning_support,
151
- self.pools.thin_provisioning_support,
152
- self.pools.total_volumes,
153
- self.pools.total_capacity_gb,
154
- self.pools.allocated_capacity_gb,
155
- self.pools.max_over_subscription_ratio,
143
+ format_columns.DictColumn(self.pools.capabilities),
156
144
  ),
157
145
  )
158
146
 
159
147
  # confirming if all expected values are present in the result.
160
148
  self.assertEqual(datalist, tuple(data))
161
149
 
162
- self.pool_mock.list.assert_called_with(
150
+ self.volume_sdk_client.backend_pools.assert_called_with(
163
151
  detailed=True,
164
152
  )