python-openstackclient 7.2.1__py3-none-any.whl → 7.3.1__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/limits.py +1 -1
- openstackclient/common/quota.py +7 -2
- openstackclient/compute/v2/server.py +38 -22
- openstackclient/compute/v2/usage.py +2 -2
- openstackclient/identity/common.py +22 -34
- openstackclient/identity/v3/credential.py +45 -28
- openstackclient/identity/v3/limit.py +15 -0
- openstackclient/identity/v3/region.py +23 -22
- openstackclient/identity/v3/registered_limit.py +18 -0
- openstackclient/identity/v3/role.py +287 -117
- openstackclient/identity/v3/role_assignment.py +1 -1
- openstackclient/identity/v3/service_provider.py +95 -45
- openstackclient/identity/v3/trust.py +114 -75
- openstackclient/image/v2/image.py +3 -0
- openstackclient/network/v2/network.py +33 -0
- openstackclient/network/v2/network_flavor_profile.py +1 -17
- openstackclient/network/v2/port.py +75 -20
- openstackclient/tests/functional/compute/v2/test_server.py +87 -1
- openstackclient/tests/functional/identity/v3/common.py +1 -1
- openstackclient/tests/functional/identity/v3/test_application_credential.py +2 -1
- openstackclient/tests/functional/identity/v3/test_role.py +24 -0
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +8 -0
- openstackclient/tests/functional/identity/v3/test_service_provider.py +1 -5
- openstackclient/tests/functional/network/v2/test_port.py +107 -1
- openstackclient/tests/unit/compute/v2/fakes.py +0 -304
- openstackclient/tests/unit/compute/v2/test_aggregate.py +40 -31
- openstackclient/tests/unit/compute/v2/test_console.py +7 -3
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +60 -53
- openstackclient/tests/unit/compute/v2/test_keypair.py +57 -69
- openstackclient/tests/unit/compute/v2/test_server.py +63 -5
- openstackclient/tests/unit/compute/v2/test_server_group.py +99 -105
- openstackclient/tests/unit/compute/v2/test_server_volume.py +12 -5
- openstackclient/tests/unit/compute/v2/test_service.py +83 -37
- openstackclient/tests/unit/compute/v2/test_usage.py +12 -7
- openstackclient/tests/unit/identity/v2_0/test_catalog.py +3 -6
- openstackclient/tests/unit/identity/v2_0/test_role.py +1 -2
- openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +2 -1
- openstackclient/tests/unit/identity/v2_0/test_token.py +6 -20
- openstackclient/tests/unit/identity/v3/test_catalog.py +2 -5
- openstackclient/tests/unit/identity/v3/test_credential.py +74 -63
- openstackclient/tests/unit/identity/v3/test_project.py +1 -3
- openstackclient/tests/unit/identity/v3/test_region.py +74 -96
- openstackclient/tests/unit/identity/v3/test_role.py +679 -603
- openstackclient/tests/unit/identity/v3/test_role_assignment.py +263 -1
- openstackclient/tests/unit/identity/v3/test_service_provider.py +159 -209
- openstackclient/tests/unit/identity/v3/test_token.py +5 -20
- openstackclient/tests/unit/identity/v3/test_trust.py +137 -155
- openstackclient/tests/unit/image/v2/test_image.py +6 -0
- openstackclient/tests/unit/network/v2/fakes.py +3 -0
- openstackclient/tests/unit/network/v2/test_network.py +25 -0
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +0 -35
- openstackclient/tests/unit/network/v2/test_port.py +128 -15
- openstackclient/tests/unit/utils.py +8 -2
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +31 -13
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +34 -13
- openstackclient/volume/v2/volume_backup.py +11 -2
- openstackclient/volume/v3/volume_backup.py +13 -2
- {python_openstackclient-7.2.1.dist-info → python_openstackclient-7.3.1.dist-info}/AUTHORS +2 -0
- {python_openstackclient-7.2.1.dist-info → python_openstackclient-7.3.1.dist-info}/METADATA +14 -16
- {python_openstackclient-7.2.1.dist-info → python_openstackclient-7.3.1.dist-info}/RECORD +65 -65
- {python_openstackclient-7.2.1.dist-info → python_openstackclient-7.3.1.dist-info}/WHEEL +1 -1
- {python_openstackclient-7.2.1.dist-info → python_openstackclient-7.3.1.dist-info}/entry_points.txt +0 -1
- python_openstackclient-7.3.1.dist-info/pbr.json +1 -0
- python_openstackclient-7.2.1.dist-info/pbr.json +0 -1
- {python_openstackclient-7.2.1.dist-info → python_openstackclient-7.3.1.dist-info}/LICENSE +0 -0
- {python_openstackclient-7.2.1.dist-info → python_openstackclient-7.3.1.dist-info}/top_level.txt +0 -0
|
@@ -23,14 +23,11 @@ class TestFlavorProfile(network_fakes.TestNetworkV2):
|
|
|
23
23
|
def setUp(self):
|
|
24
24
|
super().setUp()
|
|
25
25
|
|
|
26
|
-
# Get the ProjectManager Mock
|
|
27
|
-
self.projects_mock = self.identity_client.projects
|
|
28
26
|
# Get the DomainManager Mock
|
|
29
27
|
self.domains_mock = self.identity_client.domains
|
|
30
28
|
|
|
31
29
|
|
|
32
30
|
class TestCreateFlavorProfile(TestFlavorProfile):
|
|
33
|
-
project = identity_fakes_v3.FakeProject.create_one_project()
|
|
34
31
|
domain = identity_fakes_v3.FakeDomain.create_one_domain()
|
|
35
32
|
new_flavor_profile = network_fakes.create_one_service_profile()
|
|
36
33
|
|
|
@@ -40,7 +37,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
40
37
|
'enabled',
|
|
41
38
|
'id',
|
|
42
39
|
'meta_info',
|
|
43
|
-
'project_id',
|
|
44
40
|
)
|
|
45
41
|
|
|
46
42
|
data = (
|
|
@@ -49,7 +45,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
49
45
|
new_flavor_profile.is_enabled,
|
|
50
46
|
new_flavor_profile.id,
|
|
51
47
|
new_flavor_profile.meta_info,
|
|
52
|
-
new_flavor_profile.project_id,
|
|
53
48
|
)
|
|
54
49
|
|
|
55
50
|
def setUp(self):
|
|
@@ -57,7 +52,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
57
52
|
self.network_client.create_service_profile = mock.Mock(
|
|
58
53
|
return_value=self.new_flavor_profile
|
|
59
54
|
)
|
|
60
|
-
self.projects_mock.get.return_value = self.project
|
|
61
55
|
# Get the command object to test
|
|
62
56
|
self.cmd = network_flavor_profile.CreateNetworkFlavorProfile(
|
|
63
57
|
self.app, None
|
|
@@ -67,10 +61,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
67
61
|
arglist = [
|
|
68
62
|
"--description",
|
|
69
63
|
self.new_flavor_profile.description,
|
|
70
|
-
"--project",
|
|
71
|
-
self.new_flavor_profile.project_id,
|
|
72
|
-
'--project-domain',
|
|
73
|
-
self.domain.name,
|
|
74
64
|
"--enable",
|
|
75
65
|
"--driver",
|
|
76
66
|
self.new_flavor_profile.driver,
|
|
@@ -80,8 +70,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
80
70
|
|
|
81
71
|
verifylist = [
|
|
82
72
|
('description', self.new_flavor_profile.description),
|
|
83
|
-
('project', self.new_flavor_profile.project_id),
|
|
84
|
-
('project_domain', self.domain.name),
|
|
85
73
|
('enable', True),
|
|
86
74
|
('driver', self.new_flavor_profile.driver),
|
|
87
75
|
('metainfo', self.new_flavor_profile.meta_info),
|
|
@@ -93,7 +81,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
93
81
|
self.network_client.create_service_profile.assert_called_once_with(
|
|
94
82
|
**{
|
|
95
83
|
'description': self.new_flavor_profile.description,
|
|
96
|
-
'project_id': self.project.id,
|
|
97
84
|
'enabled': self.new_flavor_profile.is_enabled,
|
|
98
85
|
'driver': self.new_flavor_profile.driver,
|
|
99
86
|
'metainfo': self.new_flavor_profile.meta_info,
|
|
@@ -106,10 +93,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
106
93
|
arglist = [
|
|
107
94
|
"--description",
|
|
108
95
|
self.new_flavor_profile.description,
|
|
109
|
-
"--project",
|
|
110
|
-
self.new_flavor_profile.project_id,
|
|
111
|
-
'--project-domain',
|
|
112
|
-
self.domain.name,
|
|
113
96
|
"--enable",
|
|
114
97
|
"--metainfo",
|
|
115
98
|
self.new_flavor_profile.meta_info,
|
|
@@ -117,8 +100,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
117
100
|
|
|
118
101
|
verifylist = [
|
|
119
102
|
('description', self.new_flavor_profile.description),
|
|
120
|
-
('project', self.new_flavor_profile.project_id),
|
|
121
|
-
('project_domain', self.domain.name),
|
|
122
103
|
('enable', True),
|
|
123
104
|
('metainfo', self.new_flavor_profile.meta_info),
|
|
124
105
|
]
|
|
@@ -129,7 +110,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
129
110
|
self.network_client.create_service_profile.assert_called_once_with(
|
|
130
111
|
**{
|
|
131
112
|
'description': self.new_flavor_profile.description,
|
|
132
|
-
'project_id': self.project.id,
|
|
133
113
|
'enabled': self.new_flavor_profile.is_enabled,
|
|
134
114
|
'metainfo': self.new_flavor_profile.meta_info,
|
|
135
115
|
}
|
|
@@ -141,10 +121,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
141
121
|
arglist = [
|
|
142
122
|
"--description",
|
|
143
123
|
self.new_flavor_profile.description,
|
|
144
|
-
"--project",
|
|
145
|
-
self.new_flavor_profile.project_id,
|
|
146
|
-
'--project-domain',
|
|
147
|
-
self.domain.name,
|
|
148
124
|
"--enable",
|
|
149
125
|
"--driver",
|
|
150
126
|
self.new_flavor_profile.driver,
|
|
@@ -152,8 +128,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
152
128
|
|
|
153
129
|
verifylist = [
|
|
154
130
|
('description', self.new_flavor_profile.description),
|
|
155
|
-
('project', self.new_flavor_profile.project_id),
|
|
156
|
-
('project_domain', self.domain.name),
|
|
157
131
|
('enable', True),
|
|
158
132
|
('driver', self.new_flavor_profile.driver),
|
|
159
133
|
]
|
|
@@ -164,7 +138,6 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
164
138
|
self.network_client.create_service_profile.assert_called_once_with(
|
|
165
139
|
**{
|
|
166
140
|
'description': self.new_flavor_profile.description,
|
|
167
|
-
'project_id': self.project.id,
|
|
168
141
|
'enabled': self.new_flavor_profile.is_enabled,
|
|
169
142
|
'driver': self.new_flavor_profile.driver,
|
|
170
143
|
}
|
|
@@ -176,17 +149,11 @@ class TestCreateFlavorProfile(TestFlavorProfile):
|
|
|
176
149
|
arglist = [
|
|
177
150
|
"--description",
|
|
178
151
|
self.new_flavor_profile.description,
|
|
179
|
-
"--project",
|
|
180
|
-
self.new_flavor_profile.project_id,
|
|
181
|
-
'--project-domain',
|
|
182
|
-
self.domain.name,
|
|
183
152
|
"--enable",
|
|
184
153
|
]
|
|
185
154
|
|
|
186
155
|
verifylist = [
|
|
187
156
|
('description', self.new_flavor_profile.description),
|
|
188
|
-
('project', self.new_flavor_profile.project_id),
|
|
189
|
-
('project_domain', self.domain.name),
|
|
190
157
|
('enable', True),
|
|
191
158
|
]
|
|
192
159
|
|
|
@@ -377,7 +344,6 @@ class TestShowFlavorProfile(TestFlavorProfile):
|
|
|
377
344
|
'enabled',
|
|
378
345
|
'id',
|
|
379
346
|
'meta_info',
|
|
380
|
-
'project_id',
|
|
381
347
|
)
|
|
382
348
|
data = (
|
|
383
349
|
network_flavor_profile.description,
|
|
@@ -385,7 +351,6 @@ class TestShowFlavorProfile(TestFlavorProfile):
|
|
|
385
351
|
network_flavor_profile.is_enabled,
|
|
386
352
|
network_flavor_profile.id,
|
|
387
353
|
network_flavor_profile.meta_info,
|
|
388
|
-
network_flavor_profile.project_id,
|
|
389
354
|
)
|
|
390
355
|
|
|
391
356
|
def setUp(self):
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
from unittest import mock
|
|
14
14
|
from unittest.mock import call
|
|
15
|
+
import uuid
|
|
15
16
|
|
|
16
17
|
from osc_lib.cli import format_columns
|
|
17
18
|
from osc_lib import exceptions
|
|
@@ -23,8 +24,13 @@ from openstackclient.tests.unit.network.v2 import fakes as network_fakes
|
|
|
23
24
|
from openstackclient.tests.unit import utils as test_utils
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
LIST_FIELDS_TO_RETRIEVE =
|
|
27
|
-
LIST_FIELDS_TO_RETRIEVE_LONG =
|
|
27
|
+
LIST_FIELDS_TO_RETRIEVE = ['id', 'name', 'mac_address', 'fixed_ips', 'status']
|
|
28
|
+
LIST_FIELDS_TO_RETRIEVE_LONG = [
|
|
29
|
+
'security_groups',
|
|
30
|
+
'device_owner',
|
|
31
|
+
'tags',
|
|
32
|
+
'trunk_details',
|
|
33
|
+
]
|
|
28
34
|
|
|
29
35
|
|
|
30
36
|
class TestPort(network_fakes.TestNetworkV2):
|
|
@@ -73,6 +79,7 @@ class TestPort(network_fakes.TestNetworkV2):
|
|
|
73
79
|
'security_group_ids',
|
|
74
80
|
'status',
|
|
75
81
|
'tags',
|
|
82
|
+
'trusted',
|
|
76
83
|
'trunk_details',
|
|
77
84
|
'updated_at',
|
|
78
85
|
)
|
|
@@ -114,6 +121,7 @@ class TestPort(network_fakes.TestNetworkV2):
|
|
|
114
121
|
format_columns.ListColumn(fake_port.security_group_ids),
|
|
115
122
|
fake_port.status,
|
|
116
123
|
format_columns.ListColumn(fake_port.tags),
|
|
124
|
+
fake_port.trusted,
|
|
117
125
|
fake_port.trunk_details,
|
|
118
126
|
fake_port.updated_at,
|
|
119
127
|
)
|
|
@@ -330,7 +338,7 @@ class TestCreatePort(TestPort):
|
|
|
330
338
|
self._port.network_id,
|
|
331
339
|
),
|
|
332
340
|
('enable', True),
|
|
333
|
-
('
|
|
341
|
+
('security_groups', [secgroup.id]),
|
|
334
342
|
('name', 'test-port'),
|
|
335
343
|
]
|
|
336
344
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -403,7 +411,7 @@ class TestCreatePort(TestPort):
|
|
|
403
411
|
self._port.network_id,
|
|
404
412
|
),
|
|
405
413
|
('enable', True),
|
|
406
|
-
('
|
|
414
|
+
('security_groups', [sg_1.id, sg_2.id]),
|
|
407
415
|
('name', 'test-port'),
|
|
408
416
|
]
|
|
409
417
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -432,7 +440,7 @@ class TestCreatePort(TestPort):
|
|
|
432
440
|
verifylist = [
|
|
433
441
|
('network', self._port.network_id),
|
|
434
442
|
('enable', True),
|
|
435
|
-
('
|
|
443
|
+
('security_groups', []),
|
|
436
444
|
('name', 'test-port'),
|
|
437
445
|
]
|
|
438
446
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -1111,6 +1119,50 @@ class TestCreatePort(TestPort):
|
|
|
1111
1119
|
def test_create_with_hardware_offload_type_null(self):
|
|
1112
1120
|
self._test_create_with_hardware_offload_type()
|
|
1113
1121
|
|
|
1122
|
+
def _test_create_with_trusted_field(self, trusted):
|
|
1123
|
+
arglist = [
|
|
1124
|
+
'--network',
|
|
1125
|
+
self._port.network_id,
|
|
1126
|
+
'test-port',
|
|
1127
|
+
]
|
|
1128
|
+
if trusted:
|
|
1129
|
+
arglist += ['--trusted']
|
|
1130
|
+
else:
|
|
1131
|
+
arglist += ['--not-trusted']
|
|
1132
|
+
|
|
1133
|
+
verifylist = [
|
|
1134
|
+
(
|
|
1135
|
+
'network',
|
|
1136
|
+
self._port.network_id,
|
|
1137
|
+
),
|
|
1138
|
+
('name', 'test-port'),
|
|
1139
|
+
]
|
|
1140
|
+
if trusted:
|
|
1141
|
+
verifylist.append(('trusted', True))
|
|
1142
|
+
else:
|
|
1143
|
+
verifylist.append(('trusted', False))
|
|
1144
|
+
|
|
1145
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1146
|
+
|
|
1147
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
1148
|
+
|
|
1149
|
+
create_args = {
|
|
1150
|
+
'admin_state_up': True,
|
|
1151
|
+
'network_id': self._port.network_id,
|
|
1152
|
+
'name': 'test-port',
|
|
1153
|
+
}
|
|
1154
|
+
create_args['trusted'] = trusted
|
|
1155
|
+
self.network_client.create_port.assert_called_once_with(**create_args)
|
|
1156
|
+
|
|
1157
|
+
self.assertEqual(set(self.columns), set(columns))
|
|
1158
|
+
self.assertCountEqual(self.data, data)
|
|
1159
|
+
|
|
1160
|
+
def test_create_with_trusted_true(self):
|
|
1161
|
+
self._test_create_with_trusted_field(True)
|
|
1162
|
+
|
|
1163
|
+
def test_create_with_trusted_false(self):
|
|
1164
|
+
self._test_create_with_trusted_field(False)
|
|
1165
|
+
|
|
1114
1166
|
|
|
1115
1167
|
class TestDeletePort(TestPort):
|
|
1116
1168
|
# Ports to delete.
|
|
@@ -1190,17 +1242,47 @@ class TestDeletePort(TestPort):
|
|
|
1190
1242
|
|
|
1191
1243
|
|
|
1192
1244
|
class TestListPort(compute_fakes.FakeClientMixin, TestPort):
|
|
1193
|
-
|
|
1245
|
+
_project = identity_fakes.FakeProject.create_one_project()
|
|
1246
|
+
_networks = network_fakes.create_networks(count=3)
|
|
1247
|
+
_sport1 = network_fakes.create_one_port(
|
|
1248
|
+
attrs={'project_id': _project.id, 'network_id': _networks[1]['id']}
|
|
1249
|
+
)
|
|
1250
|
+
_sport2 = network_fakes.create_one_port(
|
|
1251
|
+
attrs={'project_id': _project.id, 'network_id': _networks[2]['id']}
|
|
1252
|
+
)
|
|
1253
|
+
_trunk_details = {
|
|
1254
|
+
'trunk_id': str(uuid.uuid4()),
|
|
1255
|
+
'sub_ports': [
|
|
1256
|
+
{
|
|
1257
|
+
'segmentation_id': 100,
|
|
1258
|
+
'segmentation_type': 'vlan',
|
|
1259
|
+
'port_id': _sport1.id,
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
'segmentation_id': 102,
|
|
1263
|
+
'segmentation_type': 'vlan',
|
|
1264
|
+
'port_id': _sport2.id,
|
|
1265
|
+
},
|
|
1266
|
+
],
|
|
1267
|
+
}
|
|
1268
|
+
_pport = network_fakes.create_one_port(
|
|
1269
|
+
attrs={
|
|
1270
|
+
'project_id': _project.id,
|
|
1271
|
+
'network_id': _networks[0]['id'],
|
|
1272
|
+
'trunk_details': _trunk_details,
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
_ports = (_pport, _sport1, _sport2)
|
|
1194
1276
|
|
|
1195
|
-
columns =
|
|
1277
|
+
columns = [
|
|
1196
1278
|
'ID',
|
|
1197
1279
|
'Name',
|
|
1198
1280
|
'MAC Address',
|
|
1199
1281
|
'Fixed IP Addresses',
|
|
1200
1282
|
'Status',
|
|
1201
|
-
|
|
1283
|
+
]
|
|
1202
1284
|
|
|
1203
|
-
columns_long =
|
|
1285
|
+
columns_long = [
|
|
1204
1286
|
'ID',
|
|
1205
1287
|
'Name',
|
|
1206
1288
|
'MAC Address',
|
|
@@ -1209,7 +1291,8 @@ class TestListPort(compute_fakes.FakeClientMixin, TestPort):
|
|
|
1209
1291
|
'Security Groups',
|
|
1210
1292
|
'Device Owner',
|
|
1211
1293
|
'Tags',
|
|
1212
|
-
|
|
1294
|
+
'Trunk subports',
|
|
1295
|
+
]
|
|
1213
1296
|
|
|
1214
1297
|
data = []
|
|
1215
1298
|
for prt in _ports:
|
|
@@ -1235,6 +1318,7 @@ class TestListPort(compute_fakes.FakeClientMixin, TestPort):
|
|
|
1235
1318
|
format_columns.ListColumn(prt.security_group_ids),
|
|
1236
1319
|
prt.device_owner,
|
|
1237
1320
|
format_columns.ListColumn(prt.tags),
|
|
1321
|
+
port.SubPortColumn(prt.trunk_details),
|
|
1238
1322
|
)
|
|
1239
1323
|
)
|
|
1240
1324
|
|
|
@@ -2021,7 +2105,7 @@ class TestSetPort(TestPort):
|
|
|
2021
2105
|
self._port.name,
|
|
2022
2106
|
]
|
|
2023
2107
|
verifylist = [
|
|
2024
|
-
('
|
|
2108
|
+
('security_groups', [sg.id]),
|
|
2025
2109
|
('port', self._port.name),
|
|
2026
2110
|
]
|
|
2027
2111
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -2054,7 +2138,7 @@ class TestSetPort(TestPort):
|
|
|
2054
2138
|
_testport.name,
|
|
2055
2139
|
]
|
|
2056
2140
|
verifylist = [
|
|
2057
|
-
('
|
|
2141
|
+
('security_groups', [sg_2.id, sg_3.id]),
|
|
2058
2142
|
('port', _testport.name),
|
|
2059
2143
|
]
|
|
2060
2144
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -2103,7 +2187,7 @@ class TestSetPort(TestPort):
|
|
|
2103
2187
|
_testport.name,
|
|
2104
2188
|
]
|
|
2105
2189
|
verifylist = [
|
|
2106
|
-
('
|
|
2190
|
+
('security_groups', [sg2.id]),
|
|
2107
2191
|
('no_security_group', True),
|
|
2108
2192
|
]
|
|
2109
2193
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -2520,6 +2604,35 @@ class TestSetPort(TestPort):
|
|
|
2520
2604
|
)
|
|
2521
2605
|
self.assertIsNone(result)
|
|
2522
2606
|
|
|
2607
|
+
def _test_set_trusted_field(self, trusted):
|
|
2608
|
+
arglist = [self._port.id]
|
|
2609
|
+
if trusted:
|
|
2610
|
+
arglist += ['--trusted']
|
|
2611
|
+
else:
|
|
2612
|
+
arglist += ['--not-trusted']
|
|
2613
|
+
|
|
2614
|
+
verifylist = [
|
|
2615
|
+
('port', self._port.id),
|
|
2616
|
+
]
|
|
2617
|
+
if trusted:
|
|
2618
|
+
verifylist.append(('trusted', True))
|
|
2619
|
+
else:
|
|
2620
|
+
verifylist.append(('trusted', False))
|
|
2621
|
+
|
|
2622
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
2623
|
+
|
|
2624
|
+
result = self.cmd.take_action(parsed_args)
|
|
2625
|
+
self.network_client.update_port.assert_called_once_with(
|
|
2626
|
+
self._port, **{'trusted': trusted}
|
|
2627
|
+
)
|
|
2628
|
+
self.assertIsNone(result)
|
|
2629
|
+
|
|
2630
|
+
def test_set_trusted_true(self):
|
|
2631
|
+
self._test_set_trusted_field(True)
|
|
2632
|
+
|
|
2633
|
+
def test_set_trusted_false(self):
|
|
2634
|
+
self._test_set_trusted_field(False)
|
|
2635
|
+
|
|
2523
2636
|
|
|
2524
2637
|
class TestShowPort(TestPort):
|
|
2525
2638
|
# The port to show.
|
|
@@ -2695,7 +2808,7 @@ class TestUnsetPort(TestPort):
|
|
|
2695
2808
|
_fake_port.name,
|
|
2696
2809
|
]
|
|
2697
2810
|
verifylist = [
|
|
2698
|
-
('
|
|
2811
|
+
('security_groups', [_fake_sg2.id]),
|
|
2699
2812
|
]
|
|
2700
2813
|
|
|
2701
2814
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -2722,7 +2835,7 @@ class TestUnsetPort(TestPort):
|
|
|
2722
2835
|
_fake_port.name,
|
|
2723
2836
|
]
|
|
2724
2837
|
verifylist = [
|
|
2725
|
-
('
|
|
2838
|
+
('security_groups', [_fake_sg2.id]),
|
|
2726
2839
|
]
|
|
2727
2840
|
|
|
2728
2841
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -93,8 +93,14 @@ class TestCommand(TestCase):
|
|
|
93
93
|
f"Argument parse failed: {stderr.getvalue()}"
|
|
94
94
|
)
|
|
95
95
|
for av in verify_args:
|
|
96
|
-
attr,
|
|
96
|
+
attr, expected_value = av
|
|
97
97
|
if attr:
|
|
98
|
+
actual_value = getattr(parsed_args, attr)
|
|
98
99
|
self.assertIn(attr, parsed_args)
|
|
99
|
-
self.assertEqual(
|
|
100
|
+
self.assertEqual(
|
|
101
|
+
expected_value,
|
|
102
|
+
actual_value,
|
|
103
|
+
f'args.{attr}: expected: {expected_value}, got: '
|
|
104
|
+
f'{actual_value}',
|
|
105
|
+
)
|
|
100
106
|
return parsed_args
|
|
@@ -364,16 +364,28 @@ class TestBackupRestore(volume_fakes.TestVolume):
|
|
|
364
364
|
attrs={'volume_id': volume.id},
|
|
365
365
|
)
|
|
366
366
|
|
|
367
|
+
columns = (
|
|
368
|
+
"id",
|
|
369
|
+
"volume_id",
|
|
370
|
+
"volume_name",
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
data = (
|
|
374
|
+
backup.id,
|
|
375
|
+
volume.id,
|
|
376
|
+
volume.name,
|
|
377
|
+
)
|
|
378
|
+
|
|
367
379
|
def setUp(self):
|
|
368
380
|
super().setUp()
|
|
369
381
|
|
|
370
382
|
self.volume_sdk_client.find_backup.return_value = self.backup
|
|
371
383
|
self.volume_sdk_client.find_volume.return_value = self.volume
|
|
372
|
-
self.volume_sdk_client.restore_backup.return_value =
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
384
|
+
self.volume_sdk_client.restore_backup.return_value = {
|
|
385
|
+
'id': self.backup['id'],
|
|
386
|
+
'volume_id': self.volume['id'],
|
|
387
|
+
'volume_name': self.volume['name'],
|
|
388
|
+
}
|
|
377
389
|
|
|
378
390
|
# Get the command object to mock
|
|
379
391
|
self.cmd = volume_backup.RestoreVolumeBackup(self.app, None)
|
|
@@ -389,13 +401,15 @@ class TestBackupRestore(volume_fakes.TestVolume):
|
|
|
389
401
|
]
|
|
390
402
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
391
403
|
|
|
392
|
-
|
|
404
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
393
405
|
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
394
406
|
self.backup.id,
|
|
395
407
|
volume_id=None,
|
|
396
408
|
name=None,
|
|
397
409
|
)
|
|
398
|
-
|
|
410
|
+
|
|
411
|
+
self.assertEqual(self.columns, columns)
|
|
412
|
+
self.assertEqual(self.data, data)
|
|
399
413
|
|
|
400
414
|
def test_backup_restore_with_volume(self):
|
|
401
415
|
self.volume_sdk_client.find_volume.side_effect = (
|
|
@@ -411,13 +425,15 @@ class TestBackupRestore(volume_fakes.TestVolume):
|
|
|
411
425
|
]
|
|
412
426
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
413
427
|
|
|
414
|
-
|
|
428
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
415
429
|
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
416
430
|
self.backup.id,
|
|
417
431
|
volume_id=None,
|
|
418
432
|
name=self.backup.volume_id,
|
|
419
433
|
)
|
|
420
|
-
|
|
434
|
+
|
|
435
|
+
self.assertEqual(self.columns, columns)
|
|
436
|
+
self.assertEqual(self.data, data)
|
|
421
437
|
|
|
422
438
|
def test_backup_restore_with_volume_force(self):
|
|
423
439
|
arglist = [
|
|
@@ -432,13 +448,15 @@ class TestBackupRestore(volume_fakes.TestVolume):
|
|
|
432
448
|
]
|
|
433
449
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
434
450
|
|
|
435
|
-
|
|
451
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
436
452
|
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
437
453
|
self.backup.id,
|
|
438
454
|
volume_id=self.volume.id,
|
|
439
455
|
name=None,
|
|
440
456
|
)
|
|
441
|
-
|
|
457
|
+
|
|
458
|
+
self.assertEqual(self.columns, columns)
|
|
459
|
+
self.assertEqual(self.data, data)
|
|
442
460
|
|
|
443
461
|
def test_backup_restore_with_volume_existing(self):
|
|
444
462
|
arglist = [
|
|
@@ -544,7 +562,7 @@ class TestBackupShow(volume_fakes.TestVolume):
|
|
|
544
562
|
def setUp(self):
|
|
545
563
|
super().setUp()
|
|
546
564
|
|
|
547
|
-
self.volume_sdk_client.
|
|
565
|
+
self.volume_sdk_client.find_backup.return_value = self.backup
|
|
548
566
|
# Get the command object to test
|
|
549
567
|
self.cmd = volume_backup.ShowVolumeBackup(self.app, None)
|
|
550
568
|
|
|
@@ -554,7 +572,7 @@ class TestBackupShow(volume_fakes.TestVolume):
|
|
|
554
572
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
555
573
|
|
|
556
574
|
columns, data = self.cmd.take_action(parsed_args)
|
|
557
|
-
self.volume_sdk_client.
|
|
575
|
+
self.volume_sdk_client.find_backup.assert_called_with(self.backup.id)
|
|
558
576
|
|
|
559
577
|
self.assertEqual(self.columns, columns)
|
|
560
578
|
self.assertEqual(self.data, data)
|
|
@@ -333,6 +333,7 @@ class TestBackupList(volume_fakes.TestVolume):
|
|
|
333
333
|
'Status',
|
|
334
334
|
'Size',
|
|
335
335
|
'Incremental',
|
|
336
|
+
'Created At',
|
|
336
337
|
)
|
|
337
338
|
columns_long = columns + (
|
|
338
339
|
'Availability Zone',
|
|
@@ -350,6 +351,7 @@ class TestBackupList(volume_fakes.TestVolume):
|
|
|
350
351
|
b.status,
|
|
351
352
|
b.size,
|
|
352
353
|
b.is_incremental,
|
|
354
|
+
b.created_at,
|
|
353
355
|
)
|
|
354
356
|
)
|
|
355
357
|
data_long = []
|
|
@@ -362,6 +364,7 @@ class TestBackupList(volume_fakes.TestVolume):
|
|
|
362
364
|
b.status,
|
|
363
365
|
b.size,
|
|
364
366
|
b.is_incremental,
|
|
367
|
+
b.created_at,
|
|
365
368
|
b.availability_zone,
|
|
366
369
|
volume_backup.VolumeIdColumn(b.volume_id),
|
|
367
370
|
b.container,
|
|
@@ -459,16 +462,28 @@ class TestBackupRestore(volume_fakes.TestVolume):
|
|
|
459
462
|
attrs={'volume_id': volume.id},
|
|
460
463
|
)
|
|
461
464
|
|
|
465
|
+
columns = (
|
|
466
|
+
"id",
|
|
467
|
+
"volume_id",
|
|
468
|
+
"volume_name",
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
data = (
|
|
472
|
+
backup.id,
|
|
473
|
+
volume.id,
|
|
474
|
+
volume.name,
|
|
475
|
+
)
|
|
476
|
+
|
|
462
477
|
def setUp(self):
|
|
463
478
|
super().setUp()
|
|
464
479
|
|
|
465
480
|
self.volume_sdk_client.find_backup.return_value = self.backup
|
|
466
481
|
self.volume_sdk_client.find_volume.return_value = self.volume
|
|
467
|
-
self.volume_sdk_client.restore_backup.return_value =
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
482
|
+
self.volume_sdk_client.restore_backup.return_value = {
|
|
483
|
+
'id': self.backup['id'],
|
|
484
|
+
'volume_id': self.volume['id'],
|
|
485
|
+
'volume_name': self.volume['name'],
|
|
486
|
+
}
|
|
472
487
|
|
|
473
488
|
# Get the command object to mock
|
|
474
489
|
self.cmd = volume_backup.RestoreVolumeBackup(self.app, None)
|
|
@@ -484,13 +499,15 @@ class TestBackupRestore(volume_fakes.TestVolume):
|
|
|
484
499
|
]
|
|
485
500
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
486
501
|
|
|
487
|
-
|
|
502
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
488
503
|
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
489
504
|
self.backup.id,
|
|
490
505
|
volume_id=None,
|
|
491
506
|
name=None,
|
|
492
507
|
)
|
|
493
|
-
|
|
508
|
+
|
|
509
|
+
self.assertEqual(self.columns, columns)
|
|
510
|
+
self.assertEqual(self.data, data)
|
|
494
511
|
|
|
495
512
|
def test_backup_restore_with_volume(self):
|
|
496
513
|
self.volume_sdk_client.find_volume.side_effect = (
|
|
@@ -506,13 +523,15 @@ class TestBackupRestore(volume_fakes.TestVolume):
|
|
|
506
523
|
]
|
|
507
524
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
508
525
|
|
|
509
|
-
|
|
526
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
510
527
|
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
511
528
|
self.backup.id,
|
|
512
529
|
volume_id=None,
|
|
513
530
|
name=self.backup.volume_id,
|
|
514
531
|
)
|
|
515
|
-
|
|
532
|
+
|
|
533
|
+
self.assertEqual(self.columns, columns)
|
|
534
|
+
self.assertEqual(self.data, data)
|
|
516
535
|
|
|
517
536
|
def test_backup_restore_with_volume_force(self):
|
|
518
537
|
arglist = [
|
|
@@ -527,13 +546,15 @@ class TestBackupRestore(volume_fakes.TestVolume):
|
|
|
527
546
|
]
|
|
528
547
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
529
548
|
|
|
530
|
-
|
|
549
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
531
550
|
self.volume_sdk_client.restore_backup.assert_called_with(
|
|
532
551
|
self.backup.id,
|
|
533
552
|
volume_id=self.volume.id,
|
|
534
553
|
name=None,
|
|
535
554
|
)
|
|
536
|
-
|
|
555
|
+
|
|
556
|
+
self.assertEqual(self.columns, columns)
|
|
557
|
+
self.assertEqual(self.data, data)
|
|
537
558
|
|
|
538
559
|
def test_backup_restore_with_volume_existing(self):
|
|
539
560
|
arglist = [
|
|
@@ -876,7 +897,7 @@ class TestBackupShow(volume_fakes.TestVolume):
|
|
|
876
897
|
def setUp(self):
|
|
877
898
|
super().setUp()
|
|
878
899
|
|
|
879
|
-
self.volume_sdk_client.
|
|
900
|
+
self.volume_sdk_client.find_backup.return_value = self.backup
|
|
880
901
|
# Get the command object to test
|
|
881
902
|
self.cmd = volume_backup.ShowVolumeBackup(self.app, None)
|
|
882
903
|
|
|
@@ -886,7 +907,7 @@ class TestBackupShow(volume_fakes.TestVolume):
|
|
|
886
907
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
887
908
|
|
|
888
909
|
columns, data = self.cmd.take_action(parsed_args)
|
|
889
|
-
self.volume_sdk_client.
|
|
910
|
+
self.volume_sdk_client.find_backup.assert_called_with(self.backup.id)
|
|
890
911
|
|
|
891
912
|
self.assertEqual(self.columns, columns)
|
|
892
913
|
self.assertEqual(self.data, data)
|