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
|
@@ -21,12 +21,6 @@ class SubnetPoolTests(common.NetworkTagTests):
|
|
|
21
21
|
|
|
22
22
|
base_command = 'subnet pool'
|
|
23
23
|
|
|
24
|
-
def setUp(self):
|
|
25
|
-
super(SubnetPoolTests, self).setUp()
|
|
26
|
-
# Nothing in this class works with Nova Network
|
|
27
|
-
if not self.haz_network:
|
|
28
|
-
self.skipTest("No Network service present")
|
|
29
|
-
|
|
30
24
|
def test_subnet_pool_create_delete(self):
|
|
31
25
|
"""Test create, delete"""
|
|
32
26
|
name1 = uuid.uuid4().hex
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
12
|
|
|
13
|
-
from unittest import mock
|
|
14
|
-
|
|
15
13
|
from openstackclient.common import availability_zone
|
|
16
14
|
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
|
|
17
15
|
from openstackclient.tests.unit.network.v2 import fakes as network_fakes
|
|
@@ -78,22 +76,12 @@ def _build_network_az_datalist(network_az, long_datalist=False):
|
|
|
78
76
|
return (datalist,)
|
|
79
77
|
|
|
80
78
|
|
|
81
|
-
class
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
self.app.client_manager.sdk_connection.compute = mock.Mock()
|
|
88
|
-
self.compute_client = self.app.client_manager.sdk_connection.compute
|
|
89
|
-
self.compute_client.availability_zones = mock.Mock()
|
|
90
|
-
|
|
91
|
-
self.app.client_manager.sdk_connection.volume = mock.Mock()
|
|
92
|
-
self.volume_client = self.app.client_manager.sdk_connection.volume
|
|
93
|
-
self.volume_client.availability_zones = mock.Mock()
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
class TestAvailabilityZoneList(TestAvailabilityZone):
|
|
79
|
+
class TestAvailabilityZoneList(
|
|
80
|
+
network_fakes.FakeClientMixin,
|
|
81
|
+
volume_fakes.FakeClientMixin,
|
|
82
|
+
compute_fakes.FakeClientMixin,
|
|
83
|
+
utils.TestCommand,
|
|
84
|
+
):
|
|
97
85
|
compute_azs = compute_fakes.create_availability_zones()
|
|
98
86
|
volume_azs = volume_fakes.create_availability_zones(count=1)
|
|
99
87
|
network_azs = network_fakes.create_availability_zones()
|
|
@@ -111,8 +99,12 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
|
|
|
111
99
|
def setUp(self):
|
|
112
100
|
super().setUp()
|
|
113
101
|
|
|
114
|
-
self.
|
|
115
|
-
|
|
102
|
+
self.compute_sdk_client.availability_zones.return_value = (
|
|
103
|
+
self.compute_azs
|
|
104
|
+
)
|
|
105
|
+
self.volume_sdk_client.availability_zones.return_value = (
|
|
106
|
+
self.volume_azs
|
|
107
|
+
)
|
|
116
108
|
self.network_client.availability_zones.return_value = self.network_azs
|
|
117
109
|
|
|
118
110
|
# Get the command object to test
|
|
@@ -128,8 +120,10 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
|
|
|
128
120
|
# containing the data to be listed.
|
|
129
121
|
columns, data = self.cmd.take_action(parsed_args)
|
|
130
122
|
|
|
131
|
-
self.
|
|
132
|
-
|
|
123
|
+
self.compute_sdk_client.availability_zones.assert_called_with(
|
|
124
|
+
details=True
|
|
125
|
+
)
|
|
126
|
+
self.volume_sdk_client.availability_zones.assert_called_with()
|
|
133
127
|
self.network_client.availability_zones.assert_called_with()
|
|
134
128
|
|
|
135
129
|
self.assertEqual(self.short_columnslist, columns)
|
|
@@ -156,8 +150,10 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
|
|
|
156
150
|
# containing the data to be listed.
|
|
157
151
|
columns, data = self.cmd.take_action(parsed_args)
|
|
158
152
|
|
|
159
|
-
self.
|
|
160
|
-
|
|
153
|
+
self.compute_sdk_client.availability_zones.assert_called_with(
|
|
154
|
+
details=True
|
|
155
|
+
)
|
|
156
|
+
self.volume_sdk_client.availability_zones.assert_called_with()
|
|
161
157
|
self.network_client.availability_zones.assert_called_with()
|
|
162
158
|
|
|
163
159
|
self.assertEqual(self.long_columnslist, columns)
|
|
@@ -190,8 +186,10 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
|
|
|
190
186
|
# containing the data to be listed.
|
|
191
187
|
columns, data = self.cmd.take_action(parsed_args)
|
|
192
188
|
|
|
193
|
-
self.
|
|
194
|
-
|
|
189
|
+
self.compute_sdk_client.availability_zones.assert_called_with(
|
|
190
|
+
details=True
|
|
191
|
+
)
|
|
192
|
+
self.volume_sdk_client.availability_zones.assert_not_called()
|
|
195
193
|
self.network_client.availability_zones.assert_not_called()
|
|
196
194
|
|
|
197
195
|
self.assertEqual(self.short_columnslist, columns)
|
|
@@ -214,8 +212,8 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
|
|
|
214
212
|
# containing the data to be listed.
|
|
215
213
|
columns, data = self.cmd.take_action(parsed_args)
|
|
216
214
|
|
|
217
|
-
self.
|
|
218
|
-
self.
|
|
215
|
+
self.compute_sdk_client.availability_zones.assert_not_called()
|
|
216
|
+
self.volume_sdk_client.availability_zones.assert_called_with()
|
|
219
217
|
self.network_client.availability_zones.assert_not_called()
|
|
220
218
|
|
|
221
219
|
self.assertEqual(self.short_columnslist, columns)
|
|
@@ -238,8 +236,8 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
|
|
|
238
236
|
# containing the data to be listed.
|
|
239
237
|
columns, data = self.cmd.take_action(parsed_args)
|
|
240
238
|
|
|
241
|
-
self.
|
|
242
|
-
self.
|
|
239
|
+
self.compute_sdk_client.availability_zones.assert_not_called()
|
|
240
|
+
self.volume_sdk_client.availability_zones.assert_not_called()
|
|
243
241
|
self.network_client.availability_zones.assert_called_with()
|
|
244
242
|
|
|
245
243
|
self.assertEqual(self.short_columnslist, columns)
|
|
@@ -34,12 +34,9 @@ class TestExtension(network_fakes.FakeClientMixin, utils.TestCommand):
|
|
|
34
34
|
self.identity_extensions_mock = identity_client.extensions
|
|
35
35
|
self.identity_extensions_mock.reset_mock()
|
|
36
36
|
|
|
37
|
-
sdk_connection =
|
|
38
|
-
self.app.client_manager.sdk_connection = sdk_connection
|
|
39
|
-
|
|
37
|
+
sdk_connection = self.app.client_manager.sdk_connection
|
|
40
38
|
self.compute_extensions_mock = sdk_connection.compute.extensions
|
|
41
39
|
self.compute_extensions_mock.reset_mock()
|
|
42
|
-
|
|
43
40
|
self.volume_extensions_mock = sdk_connection.volume.extensions
|
|
44
41
|
self.volume_extensions_mock.reset_mock()
|
|
45
42
|
|
|
@@ -27,10 +27,9 @@ class TestComputeLimits(compute_fakes.TestComputev2):
|
|
|
27
27
|
def setUp(self):
|
|
28
28
|
super().setUp()
|
|
29
29
|
self.app.client_manager.volume_endpoint_enabled = False
|
|
30
|
-
self.compute = self.app.client_manager.compute
|
|
31
30
|
|
|
32
31
|
self.fake_limits = compute_fakes.FakeLimits()
|
|
33
|
-
self.
|
|
32
|
+
self.compute_client.limits.get.return_value = self.fake_limits
|
|
34
33
|
|
|
35
34
|
def test_compute_show_absolute(self):
|
|
36
35
|
arglist = ['--absolute']
|
|
@@ -74,10 +73,9 @@ class TestVolumeLimits(volume_fakes.TestVolume):
|
|
|
74
73
|
def setUp(self):
|
|
75
74
|
super().setUp()
|
|
76
75
|
self.app.client_manager.compute_endpoint_enabled = False
|
|
77
|
-
self.volume = self.app.client_manager.volume
|
|
78
76
|
|
|
79
77
|
self.fake_limits = volume_fakes.FakeLimits()
|
|
80
|
-
self.
|
|
78
|
+
self.volume_client.limits.get.return_value = self.fake_limits
|
|
81
79
|
|
|
82
80
|
def test_volume_show_absolute(self):
|
|
83
81
|
arglist = ['--absolute']
|
|
@@ -15,17 +15,10 @@ from unittest import mock
|
|
|
15
15
|
|
|
16
16
|
from openstackclient.common import project_cleanup
|
|
17
17
|
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
|
|
18
|
-
from openstackclient.tests.unit import utils as
|
|
18
|
+
from openstackclient.tests.unit import utils as test_utils
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
class
|
|
22
|
-
def setUp(self):
|
|
23
|
-
super(TestProjectCleanupBase, self).setUp()
|
|
24
|
-
|
|
25
|
-
self.app.client_manager.sdk_connection = mock.Mock()
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class TestProjectCleanup(TestProjectCleanupBase):
|
|
21
|
+
class TestProjectCleanup(test_utils.TestCommand):
|
|
29
22
|
project = identity_fakes.FakeProject.create_one_project()
|
|
30
23
|
|
|
31
24
|
def setUp(self):
|
|
@@ -51,7 +44,7 @@ class TestProjectCleanup(TestProjectCleanupBase):
|
|
|
51
44
|
verifylist = []
|
|
52
45
|
|
|
53
46
|
self.assertRaises(
|
|
54
|
-
|
|
47
|
+
test_utils.ParserException,
|
|
55
48
|
self.check_parser,
|
|
56
49
|
self.cmd,
|
|
57
50
|
arglist,
|
|
@@ -48,18 +48,14 @@ class TestQuota(compute_fakes.TestComputev2):
|
|
|
48
48
|
self.projects_mock.reset_mock()
|
|
49
49
|
self.projects_mock.get.return_value = self.projects[0]
|
|
50
50
|
|
|
51
|
-
self.compute_quotas_mock = self.
|
|
51
|
+
self.compute_quotas_mock = self.compute_client.quotas
|
|
52
52
|
self.compute_quotas_mock.reset_mock()
|
|
53
|
-
self.compute_quotas_class_mock =
|
|
54
|
-
self.app.client_manager.compute.quota_classes
|
|
55
|
-
)
|
|
53
|
+
self.compute_quotas_class_mock = self.compute_client.quota_classes
|
|
56
54
|
self.compute_quotas_class_mock.reset_mock()
|
|
57
55
|
|
|
58
|
-
self.volume_quotas_mock = self.
|
|
56
|
+
self.volume_quotas_mock = self.volume_client.quotas
|
|
59
57
|
self.volume_quotas_mock.reset_mock()
|
|
60
|
-
self.volume_quotas_class_mock =
|
|
61
|
-
self.app.client_manager.volume.quota_classes
|
|
62
|
-
)
|
|
58
|
+
self.volume_quotas_class_mock = self.volume_client.quota_classes
|
|
63
59
|
self.volume_quotas_class_mock.reset_mock()
|
|
64
60
|
|
|
65
61
|
self.app.client_manager.auth_ref = mock.Mock()
|
|
@@ -127,8 +123,7 @@ class TestQuotaList(TestQuota):
|
|
|
127
123
|
compute_fakes.create_one_default_comp_quota(),
|
|
128
124
|
compute_fakes.create_one_default_comp_quota(),
|
|
129
125
|
]
|
|
130
|
-
self.
|
|
131
|
-
self.compute.quotas.defaults = mock.Mock(
|
|
126
|
+
self.compute_client.quotas.defaults = mock.Mock(
|
|
132
127
|
side_effect=self.compute_default_quotas,
|
|
133
128
|
)
|
|
134
129
|
|
|
@@ -180,8 +175,7 @@ class TestQuotaList(TestQuota):
|
|
|
180
175
|
volume_fakes.create_one_default_vol_quota(),
|
|
181
176
|
volume_fakes.create_one_default_vol_quota(),
|
|
182
177
|
]
|
|
183
|
-
self.
|
|
184
|
-
self.volume.quotas.defaults = mock.Mock(
|
|
178
|
+
self.volume_client.quotas.defaults = mock.Mock(
|
|
185
179
|
side_effect=self.volume_default_quotas,
|
|
186
180
|
)
|
|
187
181
|
|
|
@@ -224,7 +218,7 @@ class TestQuotaList(TestQuota):
|
|
|
224
218
|
detailed_quota
|
|
225
219
|
)
|
|
226
220
|
|
|
227
|
-
self.
|
|
221
|
+
self.compute_client.quotas.get = mock.Mock(return_value=detailed_quota)
|
|
228
222
|
|
|
229
223
|
arglist = [
|
|
230
224
|
'--detail',
|
|
@@ -288,7 +282,7 @@ class TestQuotaList(TestQuota):
|
|
|
288
282
|
detailed_quota
|
|
289
283
|
)
|
|
290
284
|
|
|
291
|
-
self.
|
|
285
|
+
self.volume_client.quotas.get = mock.Mock(return_value=detailed_quota)
|
|
292
286
|
|
|
293
287
|
arglist = [
|
|
294
288
|
'--detail',
|
|
@@ -308,7 +302,7 @@ class TestQuotaList(TestQuota):
|
|
|
308
302
|
|
|
309
303
|
def test_quota_list_compute(self):
|
|
310
304
|
# Two projects with non-default quotas
|
|
311
|
-
self.
|
|
305
|
+
self.compute_client.quotas.get = mock.Mock(
|
|
312
306
|
side_effect=self.compute_quotas,
|
|
313
307
|
)
|
|
314
308
|
|
|
@@ -329,7 +323,7 @@ class TestQuotaList(TestQuota):
|
|
|
329
323
|
|
|
330
324
|
def test_quota_list_compute_default(self):
|
|
331
325
|
# One of the projects is at defaults
|
|
332
|
-
self.
|
|
326
|
+
self.compute_client.quotas.get = mock.Mock(
|
|
333
327
|
side_effect=[
|
|
334
328
|
self.compute_quotas[0],
|
|
335
329
|
compute_fakes.create_one_default_comp_quota(),
|
|
@@ -353,7 +347,7 @@ class TestQuotaList(TestQuota):
|
|
|
353
347
|
|
|
354
348
|
def test_quota_list_compute_no_project_not_found(self):
|
|
355
349
|
# Make one of the projects disappear
|
|
356
|
-
self.
|
|
350
|
+
self.compute_client.quotas.get = mock.Mock(
|
|
357
351
|
side_effect=[
|
|
358
352
|
self.compute_quotas[0],
|
|
359
353
|
exceptions.NotFound("NotFound"),
|
|
@@ -377,7 +371,7 @@ class TestQuotaList(TestQuota):
|
|
|
377
371
|
|
|
378
372
|
def test_quota_list_compute_no_project_4xx(self):
|
|
379
373
|
# Make one of the projects disappear
|
|
380
|
-
self.
|
|
374
|
+
self.compute_client.quotas.get = mock.Mock(
|
|
381
375
|
side_effect=[
|
|
382
376
|
self.compute_quotas[0],
|
|
383
377
|
exceptions.BadRequest("Bad request"),
|
|
@@ -401,7 +395,7 @@ class TestQuotaList(TestQuota):
|
|
|
401
395
|
|
|
402
396
|
def test_quota_list_compute_no_project_5xx(self):
|
|
403
397
|
# Make one of the projects disappear
|
|
404
|
-
self.
|
|
398
|
+
self.compute_client.quotas.get = mock.Mock(
|
|
405
399
|
side_effect=[
|
|
406
400
|
self.compute_quotas[0],
|
|
407
401
|
exceptions.HTTPNotImplemented("Not implemented??"),
|
|
@@ -424,7 +418,7 @@ class TestQuotaList(TestQuota):
|
|
|
424
418
|
|
|
425
419
|
def test_quota_list_compute_by_project(self):
|
|
426
420
|
# Two projects with non-default quotas
|
|
427
|
-
self.
|
|
421
|
+
self.compute_client.quotas.get = mock.Mock(
|
|
428
422
|
side_effect=self.compute_quotas,
|
|
429
423
|
)
|
|
430
424
|
|
|
@@ -541,7 +535,7 @@ class TestQuotaList(TestQuota):
|
|
|
541
535
|
|
|
542
536
|
def test_quota_list_volume(self):
|
|
543
537
|
# Two projects with non-default quotas
|
|
544
|
-
self.
|
|
538
|
+
self.volume_client.quotas.get = mock.Mock(
|
|
545
539
|
side_effect=self.volume_quotas,
|
|
546
540
|
)
|
|
547
541
|
|
|
@@ -562,7 +556,7 @@ class TestQuotaList(TestQuota):
|
|
|
562
556
|
|
|
563
557
|
def test_quota_list_volume_default(self):
|
|
564
558
|
# Two projects with non-default quotas
|
|
565
|
-
self.
|
|
559
|
+
self.volume_client.quotas.get = mock.Mock(
|
|
566
560
|
side_effect=[
|
|
567
561
|
self.volume_quotas[0],
|
|
568
562
|
volume_fakes.create_one_default_vol_quota(),
|
|
@@ -586,7 +580,7 @@ class TestQuotaList(TestQuota):
|
|
|
586
580
|
|
|
587
581
|
def test_quota_list_volume_no_project(self):
|
|
588
582
|
# Two projects with non-default quotas
|
|
589
|
-
self.
|
|
583
|
+
self.volume_client.quotas.get = mock.Mock(
|
|
590
584
|
side_effect=[
|
|
591
585
|
self.volume_quotas[0],
|
|
592
586
|
volume_fakes.create_one_default_vol_quota(),
|
|
@@ -610,7 +604,7 @@ class TestQuotaList(TestQuota):
|
|
|
610
604
|
|
|
611
605
|
def test_quota_list_volume_by_project(self):
|
|
612
606
|
# Two projects with non-default quotas
|
|
613
|
-
self.
|
|
607
|
+
self.volume_client.quotas.get = mock.Mock(
|
|
614
608
|
side_effect=self.volume_quotas,
|
|
615
609
|
)
|
|
616
610
|
|
|
@@ -19,6 +19,7 @@ from unittest import mock
|
|
|
19
19
|
import uuid
|
|
20
20
|
|
|
21
21
|
from novaclient import api_versions
|
|
22
|
+
from openstack.compute.v2 import _proxy
|
|
22
23
|
from openstack.compute.v2 import aggregate as _aggregate
|
|
23
24
|
from openstack.compute.v2 import availability_zone as _availability_zone
|
|
24
25
|
from openstack.compute.v2 import extension as _extension
|
|
@@ -41,7 +42,7 @@ from openstackclient.tests.unit.identity.v2_0 import fakes as identity_fakes
|
|
|
41
42
|
from openstackclient.tests.unit.image.v2 import fakes as image_fakes
|
|
42
43
|
from openstackclient.tests.unit.network.v2 import fakes as network_fakes
|
|
43
44
|
from openstackclient.tests.unit import utils
|
|
44
|
-
from openstackclient.tests.unit.volume.
|
|
45
|
+
from openstackclient.tests.unit.volume.v3 import fakes as volume_fakes
|
|
45
46
|
|
|
46
47
|
floating_ip_num = 100
|
|
47
48
|
fix_ip_num = 100
|
|
@@ -148,11 +149,7 @@ class FakeComputev2Client(object):
|
|
|
148
149
|
self.api_version = api_versions.APIVersion('2.1')
|
|
149
150
|
|
|
150
151
|
|
|
151
|
-
class
|
|
152
|
-
network_fakes.FakeClientMixin,
|
|
153
|
-
image_fakes.FakeClientMixin,
|
|
154
|
-
utils.TestCommand,
|
|
155
|
-
):
|
|
152
|
+
class FakeClientMixin:
|
|
156
153
|
def setUp(self):
|
|
157
154
|
super().setUp()
|
|
158
155
|
|
|
@@ -160,18 +157,34 @@ class TestComputev2(
|
|
|
160
157
|
endpoint=fakes.AUTH_URL,
|
|
161
158
|
token=fakes.AUTH_TOKEN,
|
|
162
159
|
)
|
|
160
|
+
self.compute_client = self.app.client_manager.compute
|
|
163
161
|
|
|
164
|
-
self.
|
|
162
|
+
self.compute_client.api = compute_v2.APIv2(
|
|
165
163
|
session=self.app.client_manager.session,
|
|
166
164
|
endpoint=fakes.AUTH_URL,
|
|
167
165
|
)
|
|
168
166
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
# TODO(stephenfin): Rename to 'compute_client' once all commands are
|
|
168
|
+
# migrated to SDK
|
|
169
|
+
self.app.client_manager.sdk_connection.compute = mock.Mock(
|
|
170
|
+
_proxy.Proxy
|
|
172
171
|
)
|
|
172
|
+
self.compute_sdk_client = (
|
|
173
|
+
self.app.client_manager.sdk_connection.compute
|
|
174
|
+
)
|
|
175
|
+
|
|
173
176
|
|
|
174
|
-
|
|
177
|
+
class TestComputev2(
|
|
178
|
+
network_fakes.FakeClientMixin,
|
|
179
|
+
image_fakes.FakeClientMixin,
|
|
180
|
+
volume_fakes.FakeClientMixin,
|
|
181
|
+
FakeClientMixin,
|
|
182
|
+
utils.TestCommand,
|
|
183
|
+
):
|
|
184
|
+
def setUp(self):
|
|
185
|
+
super().setUp()
|
|
186
|
+
|
|
187
|
+
self.app.client_manager.identity = identity_fakes.FakeIdentityv2Client(
|
|
175
188
|
endpoint=fakes.AUTH_URL,
|
|
176
189
|
token=fakes.AUTH_TOKEN,
|
|
177
190
|
)
|