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
@@ -24,20 +24,16 @@ class TestVolumeGroup(volume_fakes.TestVolume):
24
24
  def setUp(self):
25
25
  super().setUp()
26
26
 
27
- self.volume_groups_mock = self.app.client_manager.volume.groups
27
+ self.volume_groups_mock = self.volume_client.groups
28
28
  self.volume_groups_mock.reset_mock()
29
29
 
30
- self.volume_group_types_mock = (
31
- self.app.client_manager.volume.group_types
32
- )
30
+ self.volume_group_types_mock = self.volume_client.group_types
33
31
  self.volume_group_types_mock.reset_mock()
34
32
 
35
- self.volume_types_mock = self.app.client_manager.volume.volume_types
33
+ self.volume_types_mock = self.volume_client.volume_types
36
34
  self.volume_types_mock.reset_mock()
37
35
 
38
- self.volume_group_snapshots_mock = (
39
- self.app.client_manager.volume.group_snapshots
40
- )
36
+ self.volume_group_snapshots_mock = self.volume_client.group_snapshots
41
37
  self.volume_group_snapshots_mock.reset_mock()
42
38
 
43
39
 
@@ -100,9 +96,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
100
96
  self.cmd = volume_group.CreateVolumeGroup(self.app, None)
101
97
 
102
98
  def test_volume_group_create(self):
103
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
104
- '3.13'
105
- )
99
+ self.volume_client.api_version = api_versions.APIVersion('3.13')
106
100
 
107
101
  arglist = [
108
102
  '--volume-group-type',
@@ -138,9 +132,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
138
132
  self.assertCountEqual(self.data, data)
139
133
 
140
134
  def test_volume_group_create__legacy(self):
141
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
142
- '3.13'
143
- )
135
+ self.volume_client.api_version = api_versions.APIVersion('3.13')
144
136
 
145
137
  arglist = [
146
138
  self.fake_volume_group_type.id,
@@ -180,9 +172,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
180
172
  )
181
173
 
182
174
  def test_volume_group_create_no_volume_type(self):
183
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
184
- '3.13'
185
- )
175
+ self.volume_client.api_version = api_versions.APIVersion('3.13')
186
176
 
187
177
  arglist = [
188
178
  '--volume-group-type',
@@ -204,9 +194,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
204
194
  )
205
195
 
206
196
  def test_volume_group_create_with_options(self):
207
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
208
- '3.13'
209
- )
197
+ self.volume_client.api_version = api_versions.APIVersion('3.13')
210
198
 
211
199
  arglist = [
212
200
  '--volume-group-type',
@@ -248,9 +236,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
248
236
  self.assertCountEqual(self.data, data)
249
237
 
250
238
  def test_volume_group_create_pre_v313(self):
251
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
252
- '3.12'
253
- )
239
+ self.volume_client.api_version = api_versions.APIVersion('3.12')
254
240
 
255
241
  arglist = [
256
242
  '--volume-group-type',
@@ -275,9 +261,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
275
261
  )
276
262
 
277
263
  def test_volume_group_create_from_source_group(self):
278
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
279
- '3.14'
280
- )
264
+ self.volume_client.api_version = api_versions.APIVersion('3.14')
281
265
 
282
266
  arglist = [
283
267
  '--source-group',
@@ -306,9 +290,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
306
290
  self.assertCountEqual(self.data, data)
307
291
 
308
292
  def test_volume_group_create_from_group_snapshot(self):
309
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
310
- '3.14'
311
- )
293
+ self.volume_client.api_version = api_versions.APIVersion('3.14')
312
294
 
313
295
  arglist = [
314
296
  '--group-snapshot',
@@ -337,9 +319,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
337
319
  self.assertCountEqual(self.data, data)
338
320
 
339
321
  def test_volume_group_create_from_src_pre_v314(self):
340
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
341
- '3.13'
342
- )
322
+ self.volume_client.api_version = api_versions.APIVersion('3.13')
343
323
 
344
324
  arglist = [
345
325
  '--source-group',
@@ -358,9 +338,7 @@ class TestVolumeGroupCreate(TestVolumeGroup):
358
338
  )
359
339
 
360
340
  def test_volume_group_create_from_src_source_group_group_snapshot(self):
361
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
362
- '3.14'
363
- )
341
+ self.volume_client.api_version = api_versions.APIVersion('3.14')
364
342
 
365
343
  arglist = [
366
344
  '--source-group',
@@ -398,9 +376,7 @@ class TestVolumeGroupDelete(TestVolumeGroup):
398
376
  self.cmd = volume_group.DeleteVolumeGroup(self.app, None)
399
377
 
400
378
  def test_volume_group_delete(self):
401
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
402
- '3.13'
403
- )
379
+ self.volume_client.api_version = api_versions.APIVersion('3.13')
404
380
 
405
381
  arglist = [
406
382
  self.fake_volume_group.id,
@@ -421,9 +397,7 @@ class TestVolumeGroupDelete(TestVolumeGroup):
421
397
  self.assertIsNone(result)
422
398
 
423
399
  def test_volume_group_delete_pre_v313(self):
424
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
425
- '3.12'
426
- )
400
+ self.volume_client.api_version = api_versions.APIVersion('3.12')
427
401
 
428
402
  arglist = [
429
403
  self.fake_volume_group.id,
@@ -481,9 +455,7 @@ class TestVolumeGroupSet(TestVolumeGroup):
481
455
  self.cmd = volume_group.SetVolumeGroup(self.app, None)
482
456
 
483
457
  def test_volume_group_set(self):
484
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
485
- '3.13'
486
- )
458
+ self.volume_client.api_version = api_versions.APIVersion('3.13')
487
459
 
488
460
  arglist = [
489
461
  self.fake_volume_group.id,
@@ -510,9 +482,7 @@ class TestVolumeGroupSet(TestVolumeGroup):
510
482
  self.assertCountEqual(self.data, data)
511
483
 
512
484
  def test_volume_group_with_enable_replication_option(self):
513
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
514
- '3.38'
515
- )
485
+ self.volume_client.api_version = api_versions.APIVersion('3.38')
516
486
 
517
487
  arglist = [
518
488
  self.fake_volume_group.id,
@@ -533,9 +503,7 @@ class TestVolumeGroupSet(TestVolumeGroup):
533
503
  self.assertCountEqual(self.data, data)
534
504
 
535
505
  def test_volume_group_set_pre_v313(self):
536
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
537
- '3.12'
538
- )
506
+ self.volume_client.api_version = api_versions.APIVersion('3.12')
539
507
 
540
508
  arglist = [
541
509
  self.fake_volume_group.id,
@@ -559,9 +527,7 @@ class TestVolumeGroupSet(TestVolumeGroup):
559
527
  )
560
528
 
561
529
  def test_volume_group_with_enable_replication_option_pre_v338(self):
562
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
563
- '3.37'
564
- )
530
+ self.volume_client.api_version = api_versions.APIVersion('3.37')
565
531
 
566
532
  arglist = [
567
533
  self.fake_volume_group.id,
@@ -606,9 +572,7 @@ class TestVolumeGroupList(TestVolumeGroup):
606
572
  self.cmd = volume_group.ListVolumeGroup(self.app, None)
607
573
 
608
574
  def test_volume_group_list(self):
609
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
610
- '3.13'
611
- )
575
+ self.volume_client.api_version = api_versions.APIVersion('3.13')
612
576
 
613
577
  arglist = [
614
578
  '--all-projects',
@@ -629,9 +593,7 @@ class TestVolumeGroupList(TestVolumeGroup):
629
593
  self.assertCountEqual(tuple(self.data), data)
630
594
 
631
595
  def test_volume_group_list_pre_v313(self):
632
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
633
- '3.12'
634
- )
596
+ self.volume_client.api_version = api_versions.APIVersion('3.12')
635
597
 
636
598
  arglist = [
637
599
  '--all-projects',
@@ -661,9 +623,7 @@ class TestVolumeGroupFailover(TestVolumeGroup):
661
623
  self.cmd = volume_group.FailoverVolumeGroup(self.app, None)
662
624
 
663
625
  def test_volume_group_failover(self):
664
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
665
- '3.38'
666
- )
626
+ self.volume_client.api_version = api_versions.APIVersion('3.38')
667
627
 
668
628
  arglist = [
669
629
  self.fake_volume_group.id,
@@ -688,9 +648,7 @@ class TestVolumeGroupFailover(TestVolumeGroup):
688
648
  self.assertIsNone(result)
689
649
 
690
650
  def test_volume_group_failover_pre_v338(self):
691
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
692
- '3.37'
693
- )
651
+ self.volume_client.api_version = api_versions.APIVersion('3.37')
694
652
 
695
653
  arglist = [
696
654
  self.fake_volume_group.id,
@@ -10,30 +10,32 @@
10
10
  # License for the specific language governing permissions and limitations
11
11
  # under the License.
12
12
 
13
- from cinderclient import api_versions
13
+ from unittest import mock
14
+
15
+ from keystoneauth1 import discover
16
+ from openstack.block_storage.v3 import group as _group
17
+ from openstack.block_storage.v3 import group_snapshot as _group_snapshot
18
+ from openstack.test import fakes as sdk_fakes
19
+ from openstack import utils as sdk_utils
14
20
  from osc_lib import exceptions
15
21
 
16
22
  from openstackclient.tests.unit.volume.v3 import fakes as volume_fakes
17
23
  from openstackclient.volume.v3 import volume_group_snapshot
18
24
 
19
25
 
20
- class TestVolumeGroupSnapshot(volume_fakes.TestVolume):
21
- def setUp(self):
22
- super().setUp()
26
+ def fake_supports_microversion(mocked_version):
27
+ def supports_microversion(adapter, microversion, raise_exception=False):
28
+ required = discover.normalize_version_number(microversion)
29
+ candidate = discover.normalize_version_number(mocked_version)
30
+ return discover.version_match(required, candidate)
23
31
 
24
- self.volume_groups_mock = self.app.client_manager.volume.groups
25
- self.volume_groups_mock.reset_mock()
26
-
27
- self.volume_group_snapshots_mock = (
28
- self.app.client_manager.volume.group_snapshots
29
- )
30
- self.volume_group_snapshots_mock.reset_mock()
32
+ return supports_microversion
31
33
 
32
34
 
33
- class TestVolumeGroupSnapshotCreate(TestVolumeGroupSnapshot):
34
- fake_volume_group = volume_fakes.create_one_volume_group()
35
- fake_volume_group_snapshot = (
36
- volume_fakes.create_one_volume_group_snapshot()
35
+ class TestVolumeGroupSnapshotCreate(volume_fakes.TestVolume):
36
+ fake_volume_group = sdk_fakes.generate_fake_resource(_group.Group)
37
+ fake_volume_group_snapshot = sdk_fakes.generate_fake_resource(
38
+ _group_snapshot.GroupSnapshot,
37
39
  )
38
40
 
39
41
  columns = (
@@ -56,11 +58,11 @@ class TestVolumeGroupSnapshotCreate(TestVolumeGroupSnapshot):
56
58
  def setUp(self):
57
59
  super().setUp()
58
60
 
59
- self.volume_groups_mock.get.return_value = self.fake_volume_group
60
- self.volume_group_snapshots_mock.create.return_value = (
61
+ self.volume_sdk_client.find_group.return_value = self.fake_volume_group
62
+ self.volume_sdk_client.create_group_snapshot.return_value = (
61
63
  self.fake_volume_group_snapshot
62
64
  )
63
- self.volume_group_snapshots_mock.get.return_value = (
65
+ self.volume_sdk_client.find_group_snapshot.return_value = (
64
66
  self.fake_volume_group_snapshot
65
67
  )
66
68
 
@@ -68,10 +70,9 @@ class TestVolumeGroupSnapshotCreate(TestVolumeGroupSnapshot):
68
70
  self.app, None
69
71
  )
70
72
 
71
- def test_volume_group_snapshot_create(self):
72
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
73
- '3.14'
74
- )
73
+ @mock.patch.object(sdk_utils, 'supports_microversion')
74
+ def test_volume_group_snapshot_create(self, mock_mv):
75
+ mock_mv.side_effect = fake_supports_microversion('3.14')
75
76
 
76
77
  arglist = [
77
78
  self.fake_volume_group.id,
@@ -85,21 +86,22 @@ class TestVolumeGroupSnapshotCreate(TestVolumeGroupSnapshot):
85
86
 
86
87
  columns, data = self.cmd.take_action(parsed_args)
87
88
 
88
- self.volume_groups_mock.get.assert_called_once_with(
89
- self.fake_volume_group.id
90
- )
91
- self.volume_group_snapshots_mock.create.assert_called_once_with(
89
+ self.volume_sdk_client.find_group.assert_called_once_with(
92
90
  self.fake_volume_group.id,
93
- None,
94
- None,
91
+ ignore_missing=False,
92
+ details=False,
93
+ )
94
+ self.volume_sdk_client.create_group_snapshot.assert_called_once_with(
95
+ group_id=self.fake_volume_group.id,
96
+ name=None,
97
+ description=None,
95
98
  )
96
99
  self.assertEqual(self.columns, columns)
97
100
  self.assertCountEqual(self.data, data)
98
101
 
99
- def test_volume_group_snapshot_create_with_options(self):
100
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
101
- '3.14'
102
- )
102
+ @mock.patch.object(sdk_utils, 'supports_microversion')
103
+ def test_volume_group_snapshot_create_with_options(self, mock_mv):
104
+ mock_mv.side_effect = fake_supports_microversion('3.14')
103
105
 
104
106
  arglist = [
105
107
  self.fake_volume_group.id,
@@ -117,21 +119,22 @@ class TestVolumeGroupSnapshotCreate(TestVolumeGroupSnapshot):
117
119
 
118
120
  columns, data = self.cmd.take_action(parsed_args)
119
121
 
120
- self.volume_groups_mock.get.assert_called_once_with(
121
- self.fake_volume_group.id
122
- )
123
- self.volume_group_snapshots_mock.create.assert_called_once_with(
122
+ self.volume_sdk_client.find_group.assert_called_once_with(
124
123
  self.fake_volume_group.id,
125
- 'foo',
126
- 'hello, world',
124
+ ignore_missing=False,
125
+ details=False,
126
+ )
127
+ self.volume_sdk_client.create_group_snapshot.assert_called_once_with(
128
+ group_id=self.fake_volume_group.id,
129
+ name='foo',
130
+ description='hello, world',
127
131
  )
128
132
  self.assertEqual(self.columns, columns)
129
133
  self.assertCountEqual(self.data, data)
130
134
 
131
- def test_volume_group_snapshot_create_pre_v314(self):
132
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
133
- '3.13'
134
- )
135
+ @mock.patch.object(sdk_utils, 'supports_microversion')
136
+ def test_volume_group_snapshot_create_pre_v314(self, mock_mv):
137
+ mock_mv.side_effect = fake_supports_microversion('3.13')
135
138
 
136
139
  arglist = [
137
140
  self.fake_volume_group.id,
@@ -144,34 +147,36 @@ class TestVolumeGroupSnapshotCreate(TestVolumeGroupSnapshot):
144
147
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
145
148
 
146
149
  exc = self.assertRaises(
147
- exceptions.CommandError, self.cmd.take_action, parsed_args
150
+ exceptions.CommandError,
151
+ self.cmd.take_action,
152
+ parsed_args,
148
153
  )
149
154
  self.assertIn(
150
- '--os-volume-api-version 3.14 or greater is required', str(exc)
155
+ '--os-volume-api-version 3.14 or greater is required',
156
+ str(exc),
151
157
  )
152
158
 
153
159
 
154
- class TestVolumeGroupSnapshotDelete(TestVolumeGroupSnapshot):
155
- fake_volume_group_snapshot = (
156
- volume_fakes.create_one_volume_group_snapshot()
160
+ class TestVolumeGroupSnapshotDelete(volume_fakes.TestVolume):
161
+ fake_volume_group_snapshot = sdk_fakes.generate_fake_resource(
162
+ _group_snapshot.GroupSnapshot,
157
163
  )
158
164
 
159
165
  def setUp(self):
160
166
  super().setUp()
161
167
 
162
- self.volume_group_snapshots_mock.get.return_value = (
168
+ self.volume_sdk_client.find_group_snapshot.return_value = (
163
169
  self.fake_volume_group_snapshot
164
170
  )
165
- self.volume_group_snapshots_mock.delete.return_value = None
171
+ self.volume_sdk_client.delete_group_snapshot.return_value = None
166
172
 
167
173
  self.cmd = volume_group_snapshot.DeleteVolumeGroupSnapshot(
168
174
  self.app, None
169
175
  )
170
176
 
171
- def test_volume_group_snapshot_delete(self):
172
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
173
- '3.14'
174
- )
177
+ @mock.patch.object(sdk_utils, 'supports_microversion')
178
+ def test_volume_group_snapshot_delete(self, mock_mv):
179
+ mock_mv.side_effect = fake_supports_microversion('3.14')
175
180
 
176
181
  arglist = [
177
182
  self.fake_volume_group_snapshot.id,
@@ -183,15 +188,14 @@ class TestVolumeGroupSnapshotDelete(TestVolumeGroupSnapshot):
183
188
 
184
189
  result = self.cmd.take_action(parsed_args)
185
190
 
186
- self.volume_group_snapshots_mock.delete.assert_called_once_with(
191
+ self.volume_sdk_client.delete_group_snapshot.assert_called_once_with(
187
192
  self.fake_volume_group_snapshot.id,
188
193
  )
189
194
  self.assertIsNone(result)
190
195
 
191
- def test_volume_group_snapshot_delete_pre_v314(self):
192
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
193
- '3.13'
194
- )
196
+ @mock.patch.object(sdk_utils, 'supports_microversion')
197
+ def test_volume_group_snapshot_delete_pre_v314(self, mock_mv):
198
+ mock_mv.side_effect = fake_supports_microversion('3.13')
195
199
 
196
200
  arglist = [
197
201
  self.fake_volume_group_snapshot.id,
@@ -202,15 +206,23 @@ class TestVolumeGroupSnapshotDelete(TestVolumeGroupSnapshot):
202
206
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
203
207
 
204
208
  exc = self.assertRaises(
205
- exceptions.CommandError, self.cmd.take_action, parsed_args
209
+ exceptions.CommandError,
210
+ self.cmd.take_action,
211
+ parsed_args,
206
212
  )
207
213
  self.assertIn(
208
- '--os-volume-api-version 3.14 or greater is required', str(exc)
214
+ '--os-volume-api-version 3.14 or greater is required',
215
+ str(exc),
209
216
  )
210
217
 
211
218
 
212
- class TestVolumeGroupSnapshotList(TestVolumeGroupSnapshot):
213
- fake_volume_group_snapshots = volume_fakes.create_volume_group_snapshots()
219
+ class TestVolumeGroupSnapshotList(volume_fakes.TestVolume):
220
+ fake_volume_group_snapshots = list(
221
+ sdk_fakes.generate_fake_resources(
222
+ _group_snapshot.GroupSnapshot,
223
+ count=3,
224
+ )
225
+ )
214
226
 
215
227
  columns = (
216
228
  'ID',
@@ -229,7 +241,7 @@ class TestVolumeGroupSnapshotList(TestVolumeGroupSnapshot):
229
241
  def setUp(self):
230
242
  super().setUp()
231
243
 
232
- self.volume_group_snapshots_mock.list.return_value = (
244
+ self.volume_sdk_client.group_snapshots.return_value = (
233
245
  self.fake_volume_group_snapshots
234
246
  )
235
247
 
@@ -237,10 +249,9 @@ class TestVolumeGroupSnapshotList(TestVolumeGroupSnapshot):
237
249
  self.app, None
238
250
  )
239
251
 
240
- def test_volume_group_snapshot_list(self):
241
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
242
- '3.14'
243
- )
252
+ @mock.patch.object(sdk_utils, 'supports_microversion')
253
+ def test_volume_group_snapshot_list(self, mock_mv):
254
+ mock_mv.side_effect = fake_supports_microversion('3.14')
244
255
 
245
256
  arglist = [
246
257
  '--all-projects',
@@ -252,18 +263,15 @@ class TestVolumeGroupSnapshotList(TestVolumeGroupSnapshot):
252
263
 
253
264
  columns, data = self.cmd.take_action(parsed_args)
254
265
 
255
- self.volume_group_snapshots_mock.list.assert_called_once_with(
256
- search_opts={
257
- 'all_tenants': True,
258
- },
266
+ self.volume_sdk_client.group_snapshots.assert_called_once_with(
267
+ all_projects=True,
259
268
  )
260
269
  self.assertEqual(self.columns, columns)
261
270
  self.assertCountEqual(tuple(self.data), data)
262
271
 
263
- def test_volume_group_snapshot_list_pre_v314(self):
264
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
265
- '3.13'
266
- )
272
+ @mock.patch.object(sdk_utils, 'supports_microversion')
273
+ def test_volume_group_snapshot_list_pre_v314(self, mock_mv):
274
+ mock_mv.side_effect = fake_supports_microversion('3.13')
267
275
 
268
276
  arglist = []
269
277
  verifylist = [
@@ -272,8 +280,11 @@ class TestVolumeGroupSnapshotList(TestVolumeGroupSnapshot):
272
280
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
273
281
 
274
282
  exc = self.assertRaises(
275
- exceptions.CommandError, self.cmd.take_action, parsed_args
283
+ exceptions.CommandError,
284
+ self.cmd.take_action,
285
+ parsed_args,
276
286
  )
277
287
  self.assertIn(
278
- '--os-volume-api-version 3.14 or greater is required', str(exc)
288
+ '--os-volume-api-version 3.14 or greater is required',
289
+ str(exc),
279
290
  )
@@ -24,9 +24,7 @@ class TestVolumeGroupType(volume_fakes.TestVolume):
24
24
  def setUp(self):
25
25
  super().setUp()
26
26
 
27
- self.volume_group_types_mock = (
28
- self.app.client_manager.volume.group_types
29
- )
27
+ self.volume_group_types_mock = self.volume_client.group_types
30
28
  self.volume_group_types_mock.reset_mock()
31
29
 
32
30
 
@@ -60,9 +58,7 @@ class TestVolumeGroupTypeCreate(TestVolumeGroupType):
60
58
  self.cmd = volume_group_type.CreateVolumeGroupType(self.app, None)
61
59
 
62
60
  def test_volume_group_type_create(self):
63
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
64
- '3.11'
65
- )
61
+ self.volume_client.api_version = api_versions.APIVersion('3.11')
66
62
 
67
63
  arglist = [
68
64
  self.fake_volume_group_type.name,
@@ -83,9 +79,7 @@ class TestVolumeGroupTypeCreate(TestVolumeGroupType):
83
79
  self.assertCountEqual(self.data, data)
84
80
 
85
81
  def test_volume_group_type_create_with_options(self):
86
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
87
- '3.11'
88
- )
82
+ self.volume_client.api_version = api_versions.APIVersion('3.11')
89
83
 
90
84
  arglist = [
91
85
  self.fake_volume_group_type.name,
@@ -109,9 +103,7 @@ class TestVolumeGroupTypeCreate(TestVolumeGroupType):
109
103
  self.assertCountEqual(self.data, data)
110
104
 
111
105
  def test_volume_group_type_create_pre_v311(self):
112
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
113
- '3.10'
114
- )
106
+ self.volume_client.api_version = api_versions.APIVersion('3.10')
115
107
 
116
108
  arglist = [
117
109
  self.fake_volume_group_type.name,
@@ -145,9 +137,7 @@ class TestVolumeGroupTypeDelete(TestVolumeGroupType):
145
137
  self.cmd = volume_group_type.DeleteVolumeGroupType(self.app, None)
146
138
 
147
139
  def test_volume_group_type_delete(self):
148
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
149
- '3.11'
150
- )
140
+ self.volume_client.api_version = api_versions.APIVersion('3.11')
151
141
 
152
142
  arglist = [
153
143
  self.fake_volume_group_type.id,
@@ -165,9 +155,7 @@ class TestVolumeGroupTypeDelete(TestVolumeGroupType):
165
155
  self.assertIsNone(result)
166
156
 
167
157
  def test_volume_group_type_delete_pre_v311(self):
168
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
169
- '3.10'
170
- )
158
+ self.volume_client.api_version = api_versions.APIVersion('3.10')
171
159
 
172
160
  arglist = [
173
161
  self.fake_volume_group_type.id,
@@ -222,9 +210,7 @@ class TestVolumeGroupTypeSet(TestVolumeGroupType):
222
210
  self.cmd = volume_group_type.SetVolumeGroupType(self.app, None)
223
211
 
224
212
  def test_volume_group_type_set(self):
225
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
226
- '3.11'
227
- )
213
+ self.volume_client.api_version = api_versions.APIVersion('3.11')
228
214
 
229
215
  self.fake_volume_group_type.set_keys.return_value = None
230
216
 
@@ -263,9 +249,7 @@ class TestVolumeGroupTypeSet(TestVolumeGroupType):
263
249
  self.assertCountEqual(self.data, data)
264
250
 
265
251
  def test_volume_group_type_with_no_property_option(self):
266
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
267
- '3.11'
268
- )
252
+ self.volume_client.api_version = api_versions.APIVersion('3.11')
269
253
 
270
254
  arglist = [
271
255
  self.fake_volume_group_type.id,
@@ -296,9 +280,7 @@ class TestVolumeGroupTypeSet(TestVolumeGroupType):
296
280
  self.assertCountEqual(self.data, data)
297
281
 
298
282
  def test_volume_group_type_set_pre_v311(self):
299
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
300
- '3.10'
301
- )
283
+ self.volume_client.api_version = api_versions.APIVersion('3.10')
302
284
 
303
285
  arglist = [
304
286
  self.fake_volume_group_type.id,
@@ -355,9 +337,7 @@ class TestVolumeGroupTypeUnset(TestVolumeGroupType):
355
337
  self.cmd = volume_group_type.UnsetVolumeGroupType(self.app, None)
356
338
 
357
339
  def test_volume_group_type_unset(self):
358
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
359
- '3.11'
360
- )
340
+ self.volume_client.api_version = api_versions.APIVersion('3.11')
361
341
 
362
342
  arglist = [
363
343
  self.fake_volume_group_type.id,
@@ -385,9 +365,7 @@ class TestVolumeGroupTypeUnset(TestVolumeGroupType):
385
365
  self.assertCountEqual(self.data, data)
386
366
 
387
367
  def test_volume_group_type_unset_pre_v311(self):
388
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
389
- '3.10'
390
- )
368
+ self.volume_client.api_version = api_versions.APIVersion('3.10')
391
369
 
392
370
  arglist = [
393
371
  self.fake_volume_group_type.id,
@@ -440,9 +418,7 @@ class TestVolumeGroupTypeList(TestVolumeGroupType):
440
418
  self.cmd = volume_group_type.ListVolumeGroupType(self.app, None)
441
419
 
442
420
  def test_volume_group_type_list(self):
443
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
444
- '3.11'
445
- )
421
+ self.volume_client.api_version = api_versions.APIVersion('3.11')
446
422
 
447
423
  arglist = []
448
424
  verifylist = [
@@ -457,9 +433,7 @@ class TestVolumeGroupTypeList(TestVolumeGroupType):
457
433
  self.assertCountEqual(tuple(self.data), data)
458
434
 
459
435
  def test_volume_group_type_list_with_default_option(self):
460
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
461
- '3.11'
462
- )
436
+ self.volume_client.api_version = api_versions.APIVersion('3.11')
463
437
 
464
438
  arglist = [
465
439
  '--default',
@@ -476,9 +450,7 @@ class TestVolumeGroupTypeList(TestVolumeGroupType):
476
450
  self.assertCountEqual(tuple([self.data[0]]), data)
477
451
 
478
452
  def test_volume_group_type_list_pre_v311(self):
479
- self.app.client_manager.volume.api_version = api_versions.APIVersion(
480
- '3.10'
481
- )
453
+ self.volume_client.api_version = api_versions.APIVersion('3.10')
482
454
 
483
455
  arglist = []
484
456
  verifylist = []