python-openstackclient 8.1.0__py3-none-any.whl → 8.2.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/api/compute_v2.py +2 -2
- openstackclient/api/volume_v2.py +60 -0
- openstackclient/api/volume_v3.py +60 -0
- openstackclient/compute/v2/flavor.py +14 -1
- openstackclient/compute/v2/server.py +1 -3
- openstackclient/identity/common.py +8 -13
- openstackclient/identity/v3/application_credential.py +86 -85
- openstackclient/identity/v3/domain.py +5 -6
- openstackclient/identity/v3/project.py +25 -20
- openstackclient/identity/v3/role.py +7 -2
- openstackclient/image/v1/image.py +16 -1
- openstackclient/image/v2/cache.py +10 -6
- openstackclient/image/v2/image.py +48 -1
- openstackclient/image/v2/metadef_objects.py +8 -2
- openstackclient/image/v2/metadef_properties.py +9 -2
- openstackclient/network/v2/port.py +16 -0
- openstackclient/network/v2/security_group.py +44 -3
- openstackclient/network/v2/security_group_rule.py +17 -0
- openstackclient/tests/functional/identity/v3/test_access_rule.py +1 -1
- openstackclient/tests/functional/identity/v3/test_application_credential.py +7 -7
- openstackclient/tests/functional/image/v2/test_image.py +36 -14
- openstackclient/tests/functional/volume/v2/test_volume.py +1 -1
- openstackclient/tests/functional/volume/v3/test_volume.py +2 -2
- openstackclient/tests/unit/api/test_volume_v2.py +124 -0
- openstackclient/tests/unit/api/test_volume_v3.py +124 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +159 -174
- openstackclient/tests/unit/compute/v2/test_server.py +42 -51
- openstackclient/tests/unit/identity/v3/test_application_credential.py +47 -41
- openstackclient/tests/unit/identity/v3/test_domain.py +2 -2
- openstackclient/tests/unit/identity/v3/test_project.py +30 -53
- openstackclient/tests/unit/identity/v3/test_role.py +2 -8
- openstackclient/tests/unit/image/v1/test_image.py +47 -0
- openstackclient/tests/unit/image/v2/test_image.py +79 -9
- openstackclient/tests/unit/image/v2/test_metadef_objects.py +22 -0
- openstackclient/tests/unit/image/v2/test_metadef_properties.py +24 -10
- openstackclient/tests/unit/network/v2/fakes.py +1 -0
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +2 -2
- openstackclient/tests/unit/network/v2/test_port.py +40 -0
- openstackclient/tests/unit/network/v2/test_security_group_network.py +6 -0
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +49 -0
- openstackclient/tests/unit/volume/v2/test_volume.py +358 -305
- openstackclient/tests/unit/volume/v3/test_volume.py +439 -415
- openstackclient/volume/v2/service.py +1 -1
- openstackclient/volume/v2/volume.py +78 -52
- openstackclient/volume/v3/service.py +1 -1
- openstackclient/volume/v3/volume.py +102 -75
- openstackclient/volume/v3/volume_group.py +1 -1
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.2.0.dist-info}/AUTHORS +5 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.2.0.dist-info}/METADATA +7 -7
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.2.0.dist-info}/RECORD +55 -51
- python_openstackclient-8.2.0.dist-info/pbr.json +1 -0
- python_openstackclient-8.1.0.dist-info/pbr.json +0 -1
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.2.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.2.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.2.0.dist-info}/entry_points.txt +0 -0
- {python_openstackclient-8.1.0.dist-info → python_openstackclient-8.2.0.dist-info}/top_level.txt +0 -0
|
@@ -16,12 +16,13 @@ from unittest import mock
|
|
|
16
16
|
|
|
17
17
|
from openstack.compute.v2 import flavor as _flavor
|
|
18
18
|
from openstack import exceptions as sdk_exceptions
|
|
19
|
+
from openstack.identity.v3 import project as _project
|
|
20
|
+
from openstack.test import fakes as sdk_fakes
|
|
19
21
|
from osc_lib.cli import format_columns
|
|
20
22
|
from osc_lib import exceptions
|
|
21
23
|
|
|
22
24
|
from openstackclient.compute.v2 import flavor
|
|
23
25
|
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
|
|
24
|
-
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
|
|
25
26
|
from openstackclient.tests.unit import utils as tests_utils
|
|
26
27
|
|
|
27
28
|
|
|
@@ -34,59 +35,60 @@ class TestFlavor(compute_fakes.TestComputev2):
|
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
class TestFlavorCreate(TestFlavor):
|
|
37
|
-
flavor = compute_fakes.create_one_flavor(attrs={'links': 'flavor-links'})
|
|
38
|
-
project = identity_fakes.FakeProject.create_one_project()
|
|
39
|
-
|
|
40
|
-
columns = (
|
|
41
|
-
'OS-FLV-DISABLED:disabled',
|
|
42
|
-
'OS-FLV-EXT-DATA:ephemeral',
|
|
43
|
-
'description',
|
|
44
|
-
'disk',
|
|
45
|
-
'id',
|
|
46
|
-
'name',
|
|
47
|
-
'os-flavor-access:is_public',
|
|
48
|
-
'properties',
|
|
49
|
-
'ram',
|
|
50
|
-
'rxtx_factor',
|
|
51
|
-
'swap',
|
|
52
|
-
'vcpus',
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
data = (
|
|
56
|
-
flavor.is_disabled,
|
|
57
|
-
flavor.ephemeral,
|
|
58
|
-
flavor.description,
|
|
59
|
-
flavor.disk,
|
|
60
|
-
flavor.id,
|
|
61
|
-
flavor.name,
|
|
62
|
-
flavor.is_public,
|
|
63
|
-
format_columns.DictColumn(flavor.extra_specs),
|
|
64
|
-
flavor.ram,
|
|
65
|
-
flavor.rxtx_factor,
|
|
66
|
-
flavor.swap,
|
|
67
|
-
flavor.vcpus,
|
|
68
|
-
)
|
|
69
|
-
data_private = (
|
|
70
|
-
flavor.is_disabled,
|
|
71
|
-
flavor.ephemeral,
|
|
72
|
-
flavor.description,
|
|
73
|
-
flavor.disk,
|
|
74
|
-
flavor.id,
|
|
75
|
-
flavor.name,
|
|
76
|
-
False,
|
|
77
|
-
format_columns.DictColumn(flavor.extra_specs),
|
|
78
|
-
flavor.ram,
|
|
79
|
-
flavor.rxtx_factor,
|
|
80
|
-
flavor.swap,
|
|
81
|
-
flavor.vcpus,
|
|
82
|
-
)
|
|
83
|
-
|
|
84
38
|
def setUp(self):
|
|
85
39
|
super().setUp()
|
|
86
40
|
|
|
87
|
-
|
|
41
|
+
self.flavor = sdk_fakes.generate_fake_resource(
|
|
42
|
+
_flavor.Flavor, links='flavor-links'
|
|
43
|
+
)
|
|
44
|
+
self.project = sdk_fakes.generate_fake_resource(_project.Project)
|
|
45
|
+
|
|
46
|
+
self.columns = (
|
|
47
|
+
'OS-FLV-DISABLED:disabled',
|
|
48
|
+
'OS-FLV-EXT-DATA:ephemeral',
|
|
49
|
+
'description',
|
|
50
|
+
'disk',
|
|
51
|
+
'id',
|
|
52
|
+
'name',
|
|
53
|
+
'os-flavor-access:is_public',
|
|
54
|
+
'properties',
|
|
55
|
+
'ram',
|
|
56
|
+
'rxtx_factor',
|
|
57
|
+
'swap',
|
|
58
|
+
'vcpus',
|
|
59
|
+
)
|
|
60
|
+
self.data = (
|
|
61
|
+
self.flavor.is_disabled,
|
|
62
|
+
self.flavor.ephemeral,
|
|
63
|
+
self.flavor.description,
|
|
64
|
+
self.flavor.disk,
|
|
65
|
+
self.flavor.id,
|
|
66
|
+
self.flavor.name,
|
|
67
|
+
self.flavor.is_public,
|
|
68
|
+
format_columns.DictColumn(self.flavor.extra_specs),
|
|
69
|
+
self.flavor.ram,
|
|
70
|
+
self.flavor.rxtx_factor,
|
|
71
|
+
self.flavor.swap,
|
|
72
|
+
self.flavor.vcpus,
|
|
73
|
+
)
|
|
74
|
+
self.data_private = (
|
|
75
|
+
self.flavor.is_disabled,
|
|
76
|
+
self.flavor.ephemeral,
|
|
77
|
+
self.flavor.description,
|
|
78
|
+
self.flavor.disk,
|
|
79
|
+
self.flavor.id,
|
|
80
|
+
self.flavor.name,
|
|
81
|
+
False,
|
|
82
|
+
format_columns.DictColumn(self.flavor.extra_specs),
|
|
83
|
+
self.flavor.ram,
|
|
84
|
+
self.flavor.rxtx_factor,
|
|
85
|
+
self.flavor.swap,
|
|
86
|
+
self.flavor.vcpus,
|
|
87
|
+
)
|
|
88
|
+
|
|
88
89
|
self.projects_mock.get.return_value = self.project
|
|
89
90
|
self.compute_client.create_flavor.return_value = self.flavor
|
|
91
|
+
|
|
90
92
|
self.cmd = flavor.CreateFlavor(self.app, None)
|
|
91
93
|
|
|
92
94
|
def test_flavor_create_default_options(self):
|
|
@@ -233,7 +235,7 @@ class TestFlavorCreate(TestFlavor):
|
|
|
233
235
|
('vcpus', self.flavor.vcpus),
|
|
234
236
|
('rxtx_factor', self.flavor.rxtx_factor),
|
|
235
237
|
('public', False),
|
|
236
|
-
('description',
|
|
238
|
+
('description', self.flavor.description),
|
|
237
239
|
('project', self.project.id),
|
|
238
240
|
('properties', {'key1': 'value1', 'key2': 'value2'}),
|
|
239
241
|
('name', self.flavor.name),
|
|
@@ -245,7 +247,7 @@ class TestFlavorCreate(TestFlavor):
|
|
|
245
247
|
'ram': self.flavor.ram,
|
|
246
248
|
'vcpus': self.flavor.vcpus,
|
|
247
249
|
'disk': self.flavor.disk,
|
|
248
|
-
'id':
|
|
250
|
+
'id': None,
|
|
249
251
|
'ephemeral': self.flavor.ephemeral,
|
|
250
252
|
'swap': self.flavor.swap,
|
|
251
253
|
'rxtx_factor': self.flavor.rxtx_factor,
|
|
@@ -328,7 +330,7 @@ class TestFlavorCreate(TestFlavor):
|
|
|
328
330
|
str(self.flavor.vcpus),
|
|
329
331
|
'--rxtx-factor',
|
|
330
332
|
str(self.flavor.rxtx_factor),
|
|
331
|
-
'--
|
|
333
|
+
'--public',
|
|
332
334
|
'--description',
|
|
333
335
|
'fake description',
|
|
334
336
|
self.flavor.name,
|
|
@@ -341,7 +343,7 @@ class TestFlavorCreate(TestFlavor):
|
|
|
341
343
|
('swap', self.flavor.swap),
|
|
342
344
|
('vcpus', self.flavor.vcpus),
|
|
343
345
|
('rxtx_factor', self.flavor.rxtx_factor),
|
|
344
|
-
('public',
|
|
346
|
+
('public', True),
|
|
345
347
|
('description', 'fake description'),
|
|
346
348
|
('name', self.flavor.name),
|
|
347
349
|
]
|
|
@@ -358,14 +360,14 @@ class TestFlavorCreate(TestFlavor):
|
|
|
358
360
|
'ephemeral': self.flavor.ephemeral,
|
|
359
361
|
'swap': self.flavor.swap,
|
|
360
362
|
'rxtx_factor': self.flavor.rxtx_factor,
|
|
361
|
-
'is_public':
|
|
363
|
+
'is_public': True,
|
|
362
364
|
'description': 'fake description',
|
|
363
365
|
}
|
|
364
366
|
|
|
365
367
|
self.compute_client.create_flavor.assert_called_once_with(**args)
|
|
366
368
|
|
|
367
369
|
self.assertEqual(self.columns, columns)
|
|
368
|
-
self.assertCountEqual(self.
|
|
370
|
+
self.assertCountEqual(self.data, data)
|
|
369
371
|
|
|
370
372
|
def test_flavor_create_with_description_pre_v255(self):
|
|
371
373
|
self.set_compute_api_version('2.54')
|
|
@@ -395,11 +397,13 @@ class TestFlavorCreate(TestFlavor):
|
|
|
395
397
|
|
|
396
398
|
|
|
397
399
|
class TestFlavorDelete(TestFlavor):
|
|
398
|
-
flavors = compute_fakes.create_flavors(count=2)
|
|
399
|
-
|
|
400
400
|
def setUp(self):
|
|
401
401
|
super().setUp()
|
|
402
402
|
|
|
403
|
+
self.flavors = list(
|
|
404
|
+
sdk_fakes.generate_fake_resources(_flavor.Flavor, 2)
|
|
405
|
+
)
|
|
406
|
+
|
|
403
407
|
self.compute_client.delete_flavor.return_value = None
|
|
404
408
|
|
|
405
409
|
self.cmd = flavor.DeleteFlavor(self.app, None)
|
|
@@ -474,51 +478,50 @@ class TestFlavorDelete(TestFlavor):
|
|
|
474
478
|
|
|
475
479
|
|
|
476
480
|
class TestFlavorList(TestFlavor):
|
|
477
|
-
_flavor = compute_fakes.create_one_flavor()
|
|
478
|
-
|
|
479
|
-
columns = (
|
|
480
|
-
'ID',
|
|
481
|
-
'Name',
|
|
482
|
-
'RAM',
|
|
483
|
-
'Disk',
|
|
484
|
-
'Ephemeral',
|
|
485
|
-
'VCPUs',
|
|
486
|
-
'Is Public',
|
|
487
|
-
)
|
|
488
|
-
columns_long = columns + ('Swap', 'RXTX Factor', 'Properties')
|
|
489
|
-
|
|
490
|
-
data = (
|
|
491
|
-
(
|
|
492
|
-
_flavor.id,
|
|
493
|
-
_flavor.name,
|
|
494
|
-
_flavor.ram,
|
|
495
|
-
_flavor.disk,
|
|
496
|
-
_flavor.ephemeral,
|
|
497
|
-
_flavor.vcpus,
|
|
498
|
-
_flavor.is_public,
|
|
499
|
-
),
|
|
500
|
-
)
|
|
501
|
-
data_long = (
|
|
502
|
-
data[0]
|
|
503
|
-
+ (
|
|
504
|
-
_flavor.swap,
|
|
505
|
-
_flavor.rxtx_factor,
|
|
506
|
-
format_columns.DictColumn(_flavor.extra_specs),
|
|
507
|
-
),
|
|
508
|
-
)
|
|
509
|
-
|
|
510
481
|
def setUp(self):
|
|
511
482
|
super().setUp()
|
|
512
483
|
|
|
513
|
-
self.
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
484
|
+
self._flavor = sdk_fakes.generate_fake_resource(
|
|
485
|
+
_flavor.Flavor, extra_specs={'property': 'value'}
|
|
486
|
+
)
|
|
487
|
+
|
|
488
|
+
self.columns = (
|
|
489
|
+
'ID',
|
|
490
|
+
'Name',
|
|
491
|
+
'RAM',
|
|
492
|
+
'Disk',
|
|
493
|
+
'Ephemeral',
|
|
494
|
+
'VCPUs',
|
|
495
|
+
'Is Public',
|
|
496
|
+
)
|
|
497
|
+
self.columns_long = self.columns + (
|
|
498
|
+
'Swap',
|
|
499
|
+
'RXTX Factor',
|
|
500
|
+
'Properties',
|
|
501
|
+
)
|
|
502
|
+
|
|
503
|
+
self.data = (
|
|
504
|
+
(
|
|
505
|
+
self._flavor.id,
|
|
506
|
+
self._flavor.name,
|
|
507
|
+
self._flavor.ram,
|
|
508
|
+
self._flavor.disk,
|
|
509
|
+
self._flavor.ephemeral,
|
|
510
|
+
self._flavor.vcpus,
|
|
511
|
+
self._flavor.is_public,
|
|
512
|
+
),
|
|
513
|
+
)
|
|
514
|
+
self.data_long = (
|
|
515
|
+
self.data[0]
|
|
516
|
+
+ (
|
|
517
|
+
self._flavor.swap,
|
|
518
|
+
self._flavor.rxtx_factor,
|
|
519
|
+
format_columns.DictColumn(self._flavor.extra_specs),
|
|
520
|
+
),
|
|
521
|
+
)
|
|
518
522
|
|
|
519
|
-
self.compute_client.flavors = self.
|
|
523
|
+
self.compute_client.flavors.side_effect = [[self._flavor], []]
|
|
520
524
|
|
|
521
|
-
# Get the command object to test
|
|
522
525
|
self.cmd = flavor.ListFlavor(self.app, None)
|
|
523
526
|
|
|
524
527
|
def test_flavor_list_no_options(self):
|
|
@@ -653,7 +656,9 @@ class TestFlavorList(TestFlavor):
|
|
|
653
656
|
|
|
654
657
|
def test_flavor_list_long_no_extra_specs(self):
|
|
655
658
|
# use flavor with no extra specs for this test
|
|
656
|
-
flavor =
|
|
659
|
+
flavor = sdk_fakes.generate_fake_resource(
|
|
660
|
+
_flavor.Flavor, extra_specs={}
|
|
661
|
+
)
|
|
657
662
|
self.data = (
|
|
658
663
|
(
|
|
659
664
|
flavor.id,
|
|
@@ -673,12 +678,8 @@ class TestFlavorList(TestFlavor):
|
|
|
673
678
|
format_columns.DictColumn(flavor.extra_specs),
|
|
674
679
|
),
|
|
675
680
|
)
|
|
676
|
-
self.api_mock.side_effect = [
|
|
677
|
-
[flavor],
|
|
678
|
-
[],
|
|
679
|
-
]
|
|
680
681
|
|
|
681
|
-
self.compute_client.flavors =
|
|
682
|
+
self.compute_client.flavors.side_effect = [[flavor], []]
|
|
682
683
|
self.compute_client.fetch_flavor_extra_specs = mock.Mock(
|
|
683
684
|
return_value=None
|
|
684
685
|
)
|
|
@@ -744,17 +745,15 @@ class TestFlavorList(TestFlavor):
|
|
|
744
745
|
|
|
745
746
|
|
|
746
747
|
class TestFlavorSet(TestFlavor):
|
|
747
|
-
# Return value of self.compute_client.find_flavor().
|
|
748
|
-
flavor = compute_fakes.create_one_flavor(
|
|
749
|
-
attrs={'os-flavor-access:is_public': False}
|
|
750
|
-
)
|
|
751
|
-
project = identity_fakes.FakeProject.create_one_project()
|
|
752
|
-
|
|
753
748
|
def setUp(self):
|
|
754
749
|
super().setUp()
|
|
755
750
|
|
|
751
|
+
self.flavor = sdk_fakes.generate_fake_resource(
|
|
752
|
+
_flavor.Flavor, is_public=False, extra_specs={'property': 'value'}
|
|
753
|
+
)
|
|
754
|
+
self.project = sdk_fakes.generate_fake_resource(_project.Project)
|
|
755
|
+
|
|
756
756
|
self.compute_client.find_flavor.return_value = self.flavor
|
|
757
|
-
# Return a project
|
|
758
757
|
self.projects_mock.get.return_value = self.project
|
|
759
758
|
self.cmd = flavor.SetFlavor(self.app, None)
|
|
760
759
|
|
|
@@ -960,46 +959,42 @@ class TestFlavorSet(TestFlavor):
|
|
|
960
959
|
|
|
961
960
|
|
|
962
961
|
class TestFlavorShow(TestFlavor):
|
|
963
|
-
# Return value of self.compute_client.find_flavor().
|
|
964
|
-
flavor_access = compute_fakes.create_one_flavor_access()
|
|
965
|
-
flavor = compute_fakes.create_one_flavor()
|
|
966
|
-
|
|
967
|
-
columns = (
|
|
968
|
-
'OS-FLV-DISABLED:disabled',
|
|
969
|
-
'OS-FLV-EXT-DATA:ephemeral',
|
|
970
|
-
'access_project_ids',
|
|
971
|
-
'description',
|
|
972
|
-
'disk',
|
|
973
|
-
'id',
|
|
974
|
-
'name',
|
|
975
|
-
'os-flavor-access:is_public',
|
|
976
|
-
'properties',
|
|
977
|
-
'ram',
|
|
978
|
-
'rxtx_factor',
|
|
979
|
-
'swap',
|
|
980
|
-
'vcpus',
|
|
981
|
-
)
|
|
982
|
-
|
|
983
|
-
data = (
|
|
984
|
-
flavor.is_disabled,
|
|
985
|
-
flavor.ephemeral,
|
|
986
|
-
None,
|
|
987
|
-
flavor.description,
|
|
988
|
-
flavor.disk,
|
|
989
|
-
flavor.id,
|
|
990
|
-
flavor.name,
|
|
991
|
-
flavor.is_public,
|
|
992
|
-
format_columns.DictColumn(flavor.extra_specs),
|
|
993
|
-
flavor.ram,
|
|
994
|
-
flavor.rxtx_factor,
|
|
995
|
-
flavor.swap,
|
|
996
|
-
flavor.vcpus,
|
|
997
|
-
)
|
|
998
|
-
|
|
999
962
|
def setUp(self):
|
|
1000
963
|
super().setUp()
|
|
1001
964
|
|
|
1002
|
-
|
|
965
|
+
self.flavor_access = compute_fakes.create_one_flavor_access()
|
|
966
|
+
self.flavor = sdk_fakes.generate_fake_resource(_flavor.Flavor)
|
|
967
|
+
|
|
968
|
+
self.columns = (
|
|
969
|
+
'OS-FLV-DISABLED:disabled',
|
|
970
|
+
'OS-FLV-EXT-DATA:ephemeral',
|
|
971
|
+
'access_project_ids',
|
|
972
|
+
'description',
|
|
973
|
+
'disk',
|
|
974
|
+
'id',
|
|
975
|
+
'name',
|
|
976
|
+
'os-flavor-access:is_public',
|
|
977
|
+
'properties',
|
|
978
|
+
'ram',
|
|
979
|
+
'rxtx_factor',
|
|
980
|
+
'swap',
|
|
981
|
+
'vcpus',
|
|
982
|
+
)
|
|
983
|
+
self.data = (
|
|
984
|
+
self.flavor.is_disabled,
|
|
985
|
+
self.flavor.ephemeral,
|
|
986
|
+
None,
|
|
987
|
+
self.flavor.description,
|
|
988
|
+
self.flavor.disk,
|
|
989
|
+
self.flavor.id,
|
|
990
|
+
self.flavor.name,
|
|
991
|
+
self.flavor.is_public,
|
|
992
|
+
format_columns.DictColumn(self.flavor.extra_specs),
|
|
993
|
+
self.flavor.ram,
|
|
994
|
+
self.flavor.rxtx_factor,
|
|
995
|
+
self.flavor.swap,
|
|
996
|
+
self.flavor.vcpus,
|
|
997
|
+
)
|
|
1003
998
|
self.compute_client.find_flavor.return_value = self.flavor
|
|
1004
999
|
self.compute_client.get_flavor_access.return_value = [
|
|
1005
1000
|
self.flavor_access
|
|
@@ -1035,10 +1030,8 @@ class TestFlavorShow(TestFlavor):
|
|
|
1035
1030
|
self.assertCountEqual(self.data, data)
|
|
1036
1031
|
|
|
1037
1032
|
def test_private_flavor_show(self):
|
|
1038
|
-
private_flavor =
|
|
1039
|
-
|
|
1040
|
-
'os-flavor-access:is_public': False,
|
|
1041
|
-
}
|
|
1033
|
+
private_flavor = sdk_fakes.generate_fake_resource(
|
|
1034
|
+
_flavor.Flavor, is_public=False
|
|
1042
1035
|
)
|
|
1043
1036
|
self.compute_client.find_flavor.return_value = private_flavor
|
|
1044
1037
|
|
|
@@ -1077,23 +1070,18 @@ class TestFlavorShow(TestFlavor):
|
|
|
1077
1070
|
|
|
1078
1071
|
|
|
1079
1072
|
class TestFlavorUnset(TestFlavor):
|
|
1080
|
-
# Return value of self.compute_client.find_flavor().
|
|
1081
|
-
flavor = compute_fakes.create_one_flavor(
|
|
1082
|
-
attrs={'os-flavor-access:is_public': False}
|
|
1083
|
-
)
|
|
1084
|
-
project = identity_fakes.FakeProject.create_one_project()
|
|
1085
|
-
|
|
1086
1073
|
def setUp(self):
|
|
1087
1074
|
super().setUp()
|
|
1088
1075
|
|
|
1076
|
+
self.flavor = sdk_fakes.generate_fake_resource(
|
|
1077
|
+
_flavor.Flavor, is_public=False
|
|
1078
|
+
)
|
|
1079
|
+
self.project = sdk_fakes.generate_fake_resource(_project.Project)
|
|
1080
|
+
|
|
1089
1081
|
self.compute_client.find_flavor.return_value = self.flavor
|
|
1090
|
-
# Return a project
|
|
1091
1082
|
self.projects_mock.get.return_value = self.project
|
|
1092
|
-
self.cmd = flavor.UnsetFlavor(self.app, None)
|
|
1093
1083
|
|
|
1094
|
-
self.
|
|
1095
|
-
self.compute_client.delete_flavor_extra_specs_property
|
|
1096
|
-
)
|
|
1084
|
+
self.cmd = flavor.UnsetFlavor(self.app, None)
|
|
1097
1085
|
|
|
1098
1086
|
def test_flavor_unset_property(self):
|
|
1099
1087
|
arglist = ['--property', 'property', 'baremetal']
|
|
@@ -1107,7 +1095,9 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1107
1095
|
self.compute_client.find_flavor.assert_called_with(
|
|
1108
1096
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
1109
1097
|
)
|
|
1110
|
-
self.
|
|
1098
|
+
self.compute_client.delete_flavor_extra_specs_property.assert_called_with(
|
|
1099
|
+
self.flavor.id, 'property'
|
|
1100
|
+
)
|
|
1111
1101
|
self.compute_client.flavor_remove_tenant_access.assert_not_called()
|
|
1112
1102
|
self.assertIsNone(result)
|
|
1113
1103
|
|
|
@@ -1126,21 +1116,16 @@ class TestFlavorUnset(TestFlavor):
|
|
|
1126
1116
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1127
1117
|
|
|
1128
1118
|
self.cmd.take_action(parsed_args)
|
|
1119
|
+
|
|
1129
1120
|
self.compute_client.find_flavor.assert_called_with(
|
|
1130
1121
|
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
|
1131
1122
|
)
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
# A bit tricky way to ensure we do not unset other properties
|
|
1139
|
-
calls.append(mock.call(self.flavor.id, 'property'))
|
|
1140
|
-
self.assertRaises(
|
|
1141
|
-
AssertionError, self.mock_shortcut.assert_has_calls, calls
|
|
1123
|
+
self.compute_client.delete_flavor_extra_specs_property.assert_has_calls(
|
|
1124
|
+
[
|
|
1125
|
+
mock.call(self.flavor.id, 'property1'),
|
|
1126
|
+
mock.call(self.flavor.id, 'property2'),
|
|
1127
|
+
]
|
|
1142
1128
|
)
|
|
1143
|
-
|
|
1144
1129
|
self.compute_client.flavor_remove_tenant_access.assert_not_called()
|
|
1145
1130
|
|
|
1146
1131
|
def test_flavor_unset_project(self):
|