python-openstackclient 7.2.0__py3-none-any.whl → 7.3.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/clientmanager.py +6 -1
- 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 +73 -19
- 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 +28 -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 +129 -16
- 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.0.dist-info → python_openstackclient-7.3.0.dist-info}/AUTHORS +2 -0
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/METADATA +14 -16
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/RECORD +66 -66
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/entry_points.txt +0 -1
- python_openstackclient-7.3.0.dist-info/pbr.json +1 -0
- python_openstackclient-7.2.0.dist-info/pbr.json +0 -1
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/top_level.txt +0 -0
|
@@ -11,58 +11,36 @@
|
|
|
11
11
|
# under the License.
|
|
12
12
|
#
|
|
13
13
|
|
|
14
|
-
import copy
|
|
15
14
|
from unittest import mock
|
|
16
15
|
|
|
17
16
|
from osc_lib import exceptions
|
|
18
|
-
|
|
17
|
+
|
|
18
|
+
from openstack import exceptions as sdk_exceptions
|
|
19
|
+
from openstack.identity.v3 import project as _project
|
|
20
|
+
from openstack.identity.v3 import role as _role
|
|
21
|
+
from openstack.identity.v3 import trust as _trust
|
|
22
|
+
from openstack.identity.v3 import user as _user
|
|
23
|
+
from openstack.test import fakes as sdk_fakes
|
|
19
24
|
|
|
20
25
|
from openstackclient.identity.v3 import trust
|
|
21
|
-
from openstackclient.tests.unit import fakes
|
|
22
26
|
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
|
|
23
27
|
|
|
24
28
|
|
|
25
|
-
class
|
|
29
|
+
class TestTrustCreate(identity_fakes.TestIdentityv3):
|
|
26
30
|
def setUp(self):
|
|
27
31
|
super().setUp()
|
|
28
32
|
|
|
29
|
-
self.
|
|
30
|
-
self.
|
|
31
|
-
self.projects_mock = self.identity_client.projects
|
|
32
|
-
self.projects_mock.reset_mock()
|
|
33
|
-
self.users_mock = self.identity_client.users
|
|
34
|
-
self.users_mock.reset_mock()
|
|
35
|
-
self.roles_mock = self.identity_client.roles
|
|
36
|
-
self.roles_mock.reset_mock()
|
|
37
|
-
|
|
33
|
+
self.trust = sdk_fakes.generate_fake_resource(_trust.Trust)
|
|
34
|
+
self.identity_sdk_client.create_trust.return_value = self.trust
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
super().setUp()
|
|
36
|
+
self.project = sdk_fakes.generate_fake_resource(_project.Project)
|
|
37
|
+
self.identity_sdk_client.find_project.return_value = self.project
|
|
42
38
|
|
|
43
|
-
self.
|
|
44
|
-
|
|
45
|
-
copy.deepcopy(identity_fakes.PROJECT),
|
|
46
|
-
loaded=True,
|
|
47
|
-
)
|
|
39
|
+
self.user = sdk_fakes.generate_fake_resource(_user.User)
|
|
40
|
+
self.identity_sdk_client.find_user.return_value = self.user
|
|
48
41
|
|
|
49
|
-
self.
|
|
50
|
-
|
|
51
|
-
copy.deepcopy(identity_fakes.USER),
|
|
52
|
-
loaded=True,
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
self.roles_mock.get.return_value = fakes.FakeResource(
|
|
56
|
-
None,
|
|
57
|
-
copy.deepcopy(identity_fakes.ROLE),
|
|
58
|
-
loaded=True,
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
self.trusts_mock.create.return_value = fakes.FakeResource(
|
|
62
|
-
None,
|
|
63
|
-
copy.deepcopy(identity_fakes.TRUST),
|
|
64
|
-
loaded=True,
|
|
65
|
-
)
|
|
42
|
+
self.role = sdk_fakes.generate_fake_resource(_role.Role)
|
|
43
|
+
self.identity_sdk_client.find_role.return_value = self.role
|
|
66
44
|
|
|
67
45
|
# Get the command object to test
|
|
68
46
|
self.cmd = trust.CreateTrust(self.app, None)
|
|
@@ -70,18 +48,17 @@ class TestTrustCreate(TestTrust):
|
|
|
70
48
|
def test_trust_create_basic(self):
|
|
71
49
|
arglist = [
|
|
72
50
|
'--project',
|
|
73
|
-
|
|
51
|
+
self.project.id,
|
|
74
52
|
'--role',
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
53
|
+
self.role.id,
|
|
54
|
+
self.user.id,
|
|
55
|
+
self.user.id,
|
|
78
56
|
]
|
|
79
57
|
verifylist = [
|
|
80
|
-
('project',
|
|
81
|
-
('
|
|
82
|
-
('
|
|
83
|
-
('
|
|
84
|
-
('trustee', identity_fakes.user_id),
|
|
58
|
+
('project', self.project.id),
|
|
59
|
+
('roles', [self.role.id]),
|
|
60
|
+
('trustor', self.user.id),
|
|
61
|
+
('trustee', self.user.id),
|
|
85
62
|
]
|
|
86
63
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
87
64
|
|
|
@@ -92,76 +69,71 @@ class TestTrustCreate(TestTrust):
|
|
|
92
69
|
|
|
93
70
|
# Set expected values
|
|
94
71
|
kwargs = {
|
|
95
|
-
'
|
|
96
|
-
'
|
|
97
|
-
'role_ids': [identity_fakes.role_id],
|
|
98
|
-
'expires_at': None,
|
|
72
|
+
'project_id': self.project.id,
|
|
73
|
+
'roles': [self.role.id],
|
|
99
74
|
}
|
|
100
75
|
# TrustManager.create(trustee_id, trustor_id, impersonation=,
|
|
101
76
|
# project=, role_names=, expires_at=)
|
|
102
|
-
self.
|
|
103
|
-
|
|
77
|
+
self.identity_sdk_client.create_trust.assert_called_with(
|
|
78
|
+
trustor_id=self.user.id, trustee_id=self.user.id, **kwargs
|
|
104
79
|
)
|
|
105
80
|
|
|
106
81
|
collist = (
|
|
107
82
|
'expires_at',
|
|
108
83
|
'id',
|
|
109
|
-
'
|
|
84
|
+
'is_impersonation',
|
|
110
85
|
'project_id',
|
|
86
|
+
'redelegated_trust_id',
|
|
87
|
+
'redelegation_count',
|
|
88
|
+
'remaining_uses',
|
|
111
89
|
'roles',
|
|
112
90
|
'trustee_user_id',
|
|
113
91
|
'trustor_user_id',
|
|
114
92
|
)
|
|
115
93
|
self.assertEqual(collist, columns)
|
|
116
94
|
datalist = (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
95
|
+
self.trust.expires_at,
|
|
96
|
+
self.trust.id,
|
|
97
|
+
self.trust.is_impersonation,
|
|
98
|
+
self.trust.project_id,
|
|
99
|
+
self.trust.redelegated_trust_id,
|
|
100
|
+
self.trust.redelegation_count,
|
|
101
|
+
self.trust.remaining_uses,
|
|
102
|
+
self.trust.roles,
|
|
103
|
+
self.trust.trustee_user_id,
|
|
104
|
+
self.trust.trustor_user_id,
|
|
124
105
|
)
|
|
125
106
|
self.assertEqual(datalist, data)
|
|
126
107
|
|
|
127
108
|
|
|
128
|
-
class TestTrustDelete(
|
|
109
|
+
class TestTrustDelete(identity_fakes.TestIdentityv3):
|
|
129
110
|
def setUp(self):
|
|
130
111
|
super().setUp()
|
|
131
112
|
|
|
132
|
-
|
|
133
|
-
self.
|
|
134
|
-
|
|
135
|
-
copy.deepcopy(identity_fakes.TRUST),
|
|
136
|
-
loaded=True,
|
|
137
|
-
)
|
|
138
|
-
self.trusts_mock.delete.return_value = None
|
|
113
|
+
self.trust = sdk_fakes.generate_fake_resource(_trust.Trust)
|
|
114
|
+
self.identity_sdk_client.delete_trust.return_value = None
|
|
115
|
+
self.identity_sdk_client.find_trust.return_value = self.trust
|
|
139
116
|
|
|
140
117
|
# Get the command object to test
|
|
141
118
|
self.cmd = trust.DeleteTrust(self.app, None)
|
|
142
119
|
|
|
143
120
|
def test_trust_delete(self):
|
|
144
121
|
arglist = [
|
|
145
|
-
|
|
122
|
+
self.trust.id,
|
|
146
123
|
]
|
|
147
|
-
verifylist = [('trust', [
|
|
124
|
+
verifylist = [('trust', [self.trust.id])]
|
|
148
125
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
149
126
|
|
|
150
127
|
result = self.cmd.take_action(parsed_args)
|
|
151
128
|
|
|
152
|
-
self.
|
|
153
|
-
|
|
129
|
+
self.identity_sdk_client.delete_trust.assert_called_with(
|
|
130
|
+
self.trust.id,
|
|
154
131
|
)
|
|
155
132
|
self.assertIsNone(result)
|
|
156
133
|
|
|
157
|
-
|
|
158
|
-
def test_delete_multi_trusts_with_exception(self, find_mock):
|
|
159
|
-
find_mock.side_effect = [
|
|
160
|
-
self.trusts_mock.get.return_value,
|
|
161
|
-
exceptions.CommandError,
|
|
162
|
-
]
|
|
134
|
+
def test_delete_multi_trusts_with_exception(self):
|
|
163
135
|
arglist = [
|
|
164
|
-
|
|
136
|
+
self.trust.id,
|
|
165
137
|
'unexist_trust',
|
|
166
138
|
]
|
|
167
139
|
verifylist = [
|
|
@@ -169,32 +141,37 @@ class TestTrustDelete(TestTrust):
|
|
|
169
141
|
]
|
|
170
142
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
171
143
|
|
|
144
|
+
self.identity_sdk_client.find_trust.side_effect = [
|
|
145
|
+
self.trust,
|
|
146
|
+
sdk_exceptions.ResourceNotFound,
|
|
147
|
+
]
|
|
148
|
+
|
|
172
149
|
try:
|
|
173
150
|
self.cmd.take_action(parsed_args)
|
|
174
151
|
self.fail('CommandError should be raised.')
|
|
175
152
|
except exceptions.CommandError as e:
|
|
176
153
|
self.assertEqual('1 of 2 trusts failed to delete.', str(e))
|
|
177
154
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
155
|
+
self.identity_sdk_client.find_trust.assert_has_calls(
|
|
156
|
+
[
|
|
157
|
+
mock.call(self.trust.id, ignore_missing=False),
|
|
158
|
+
mock.call('unexist_trust', ignore_missing=False),
|
|
159
|
+
]
|
|
160
|
+
)
|
|
161
|
+
self.identity_sdk_client.delete_trust.assert_called_once_with(
|
|
162
|
+
self.trust.id
|
|
184
163
|
)
|
|
185
164
|
|
|
186
165
|
|
|
187
|
-
class TestTrustList(
|
|
166
|
+
class TestTrustList(identity_fakes.TestIdentityv3):
|
|
188
167
|
def setUp(self):
|
|
189
168
|
super().setUp()
|
|
190
169
|
|
|
191
|
-
self.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
),
|
|
197
|
-
]
|
|
170
|
+
self.trust = sdk_fakes.generate_fake_resource(_trust.Trust)
|
|
171
|
+
self.identity_sdk_client.trusts.return_value = [self.trust]
|
|
172
|
+
|
|
173
|
+
self.user = sdk_fakes.generate_fake_resource(_user.User)
|
|
174
|
+
self.identity_sdk_client.find_user.return_value = self.user
|
|
198
175
|
|
|
199
176
|
# Get the command object to test
|
|
200
177
|
self.cmd = trust.ListTrust(self.app, None)
|
|
@@ -209,9 +186,9 @@ class TestTrustList(TestTrust):
|
|
|
209
186
|
# containing the data to be listed.
|
|
210
187
|
columns, data = self.cmd.take_action(parsed_args)
|
|
211
188
|
|
|
212
|
-
self.
|
|
213
|
-
|
|
214
|
-
|
|
189
|
+
self.identity_sdk_client.trusts.assert_called_with(
|
|
190
|
+
trustor_user_id=None,
|
|
191
|
+
trustee_user_id=None,
|
|
215
192
|
)
|
|
216
193
|
|
|
217
194
|
collist = (
|
|
@@ -225,19 +202,19 @@ class TestTrustList(TestTrust):
|
|
|
225
202
|
self.assertEqual(collist, columns)
|
|
226
203
|
datalist = (
|
|
227
204
|
(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
205
|
+
self.trust.id,
|
|
206
|
+
self.trust.expires_at,
|
|
207
|
+
self.trust.is_impersonation,
|
|
208
|
+
self.trust.project_id,
|
|
209
|
+
self.trust.trustee_user_id,
|
|
210
|
+
self.trust.trustor_user_id,
|
|
234
211
|
),
|
|
235
212
|
)
|
|
236
213
|
self.assertEqual(datalist, tuple(data))
|
|
237
214
|
|
|
238
215
|
def test_trust_list_auth_user(self):
|
|
239
|
-
|
|
240
|
-
auth_ref
|
|
216
|
+
self.app.client_manager.auth_ref = mock.Mock()
|
|
217
|
+
auth_ref = self.app.client_manager.auth_ref
|
|
241
218
|
|
|
242
219
|
arglist = ['--auth-user']
|
|
243
220
|
verifylist = [
|
|
@@ -252,11 +229,11 @@ class TestTrustList(TestTrust):
|
|
|
252
229
|
# containing the data to be listed.
|
|
253
230
|
columns, data = self.cmd.take_action(parsed_args)
|
|
254
231
|
|
|
255
|
-
self.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
232
|
+
self.identity_sdk_client.trusts.assert_has_calls(
|
|
233
|
+
[
|
|
234
|
+
mock.call(trustor_user_id=auth_ref.user_id),
|
|
235
|
+
mock.call(trustee_user_id=auth_ref.user_id),
|
|
236
|
+
]
|
|
260
237
|
)
|
|
261
238
|
|
|
262
239
|
collist = (
|
|
@@ -270,21 +247,21 @@ class TestTrustList(TestTrust):
|
|
|
270
247
|
self.assertEqual(collist, columns)
|
|
271
248
|
datalist = (
|
|
272
249
|
(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
250
|
+
self.trust.id,
|
|
251
|
+
self.trust.expires_at,
|
|
252
|
+
self.trust.is_impersonation,
|
|
253
|
+
self.trust.project_id,
|
|
254
|
+
self.trust.trustee_user_id,
|
|
255
|
+
self.trust.trustor_user_id,
|
|
279
256
|
),
|
|
280
257
|
)
|
|
281
258
|
self.assertEqual(datalist, tuple(data))
|
|
282
259
|
|
|
283
260
|
def test_trust_list_trustee(self):
|
|
284
|
-
arglist = ['--trustee',
|
|
261
|
+
arglist = ['--trustee', self.user.name]
|
|
285
262
|
verifylist = [
|
|
286
263
|
('trustor', None),
|
|
287
|
-
('trustee',
|
|
264
|
+
('trustee', self.user.name),
|
|
288
265
|
('authuser', False),
|
|
289
266
|
]
|
|
290
267
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -294,9 +271,9 @@ class TestTrustList(TestTrust):
|
|
|
294
271
|
# containing the data to be listed.
|
|
295
272
|
columns, data = self.cmd.take_action(parsed_args)
|
|
296
273
|
|
|
297
|
-
self.
|
|
298
|
-
|
|
299
|
-
|
|
274
|
+
self.identity_sdk_client.trusts.assert_called_with(
|
|
275
|
+
trustee_user_id=self.user.id,
|
|
276
|
+
trustor_user_id=None,
|
|
300
277
|
)
|
|
301
278
|
|
|
302
279
|
collist = (
|
|
@@ -310,21 +287,21 @@ class TestTrustList(TestTrust):
|
|
|
310
287
|
self.assertEqual(collist, columns)
|
|
311
288
|
datalist = (
|
|
312
289
|
(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
290
|
+
self.trust.id,
|
|
291
|
+
self.trust.expires_at,
|
|
292
|
+
self.trust.is_impersonation,
|
|
293
|
+
self.trust.project_id,
|
|
294
|
+
self.trust.trustee_user_id,
|
|
295
|
+
self.trust.trustor_user_id,
|
|
319
296
|
),
|
|
320
297
|
)
|
|
321
298
|
self.assertEqual(datalist, tuple(data))
|
|
322
299
|
|
|
323
300
|
def test_trust_list_trustor(self):
|
|
324
|
-
arglist = ['--trustor',
|
|
301
|
+
arglist = ['--trustor', self.user.name]
|
|
325
302
|
verifylist = [
|
|
326
303
|
('trustee', None),
|
|
327
|
-
('trustor',
|
|
304
|
+
('trustor', self.user.name),
|
|
328
305
|
('authuser', False),
|
|
329
306
|
]
|
|
330
307
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -334,9 +311,9 @@ class TestTrustList(TestTrust):
|
|
|
334
311
|
# containing the data to be listed.
|
|
335
312
|
columns, data = self.cmd.take_action(parsed_args)
|
|
336
313
|
|
|
337
|
-
self.
|
|
338
|
-
|
|
339
|
-
|
|
314
|
+
self.identity_sdk_client.trusts.assert_called_once_with(
|
|
315
|
+
trustor_user_id=self.user.id,
|
|
316
|
+
trustee_user_id=None,
|
|
340
317
|
)
|
|
341
318
|
|
|
342
319
|
collist = (
|
|
@@ -350,36 +327,33 @@ class TestTrustList(TestTrust):
|
|
|
350
327
|
self.assertEqual(collist, columns)
|
|
351
328
|
datalist = (
|
|
352
329
|
(
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
330
|
+
self.trust.id,
|
|
331
|
+
self.trust.expires_at,
|
|
332
|
+
self.trust.is_impersonation,
|
|
333
|
+
self.trust.project_id,
|
|
334
|
+
self.trust.trustee_user_id,
|
|
335
|
+
self.trust.trustor_user_id,
|
|
359
336
|
),
|
|
360
337
|
)
|
|
361
338
|
self.assertEqual(datalist, tuple(data))
|
|
362
339
|
|
|
363
340
|
|
|
364
|
-
class TestTrustShow(
|
|
341
|
+
class TestTrustShow(identity_fakes.TestIdentityv3):
|
|
365
342
|
def setUp(self):
|
|
366
343
|
super().setUp()
|
|
367
344
|
|
|
368
|
-
self.
|
|
369
|
-
|
|
370
|
-
copy.deepcopy(identity_fakes.TRUST),
|
|
371
|
-
loaded=True,
|
|
372
|
-
)
|
|
345
|
+
self.trust = sdk_fakes.generate_fake_resource(_trust.Trust)
|
|
346
|
+
self.identity_sdk_client.find_trust.return_value = self.trust
|
|
373
347
|
|
|
374
348
|
# Get the command object to test
|
|
375
349
|
self.cmd = trust.ShowTrust(self.app, None)
|
|
376
350
|
|
|
377
351
|
def test_trust_show(self):
|
|
378
352
|
arglist = [
|
|
379
|
-
|
|
353
|
+
self.trust.id,
|
|
380
354
|
]
|
|
381
355
|
verifylist = [
|
|
382
|
-
('trust',
|
|
356
|
+
('trust', self.trust.id),
|
|
383
357
|
]
|
|
384
358
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
385
359
|
|
|
@@ -388,25 +362,33 @@ class TestTrustShow(TestTrust):
|
|
|
388
362
|
# data to be shown.
|
|
389
363
|
columns, data = self.cmd.take_action(parsed_args)
|
|
390
364
|
|
|
391
|
-
self.
|
|
365
|
+
self.identity_sdk_client.find_trust.assert_called_with(
|
|
366
|
+
self.trust.id, ignore_missing=False
|
|
367
|
+
)
|
|
392
368
|
|
|
393
369
|
collist = (
|
|
394
370
|
'expires_at',
|
|
395
371
|
'id',
|
|
396
|
-
'
|
|
372
|
+
'is_impersonation',
|
|
397
373
|
'project_id',
|
|
374
|
+
'redelegated_trust_id',
|
|
375
|
+
'redelegation_count',
|
|
376
|
+
'remaining_uses',
|
|
398
377
|
'roles',
|
|
399
378
|
'trustee_user_id',
|
|
400
379
|
'trustor_user_id',
|
|
401
380
|
)
|
|
402
381
|
self.assertEqual(collist, columns)
|
|
403
382
|
datalist = (
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
383
|
+
self.trust.expires_at,
|
|
384
|
+
self.trust.id,
|
|
385
|
+
self.trust.is_impersonation,
|
|
386
|
+
self.trust.project_id,
|
|
387
|
+
self.trust.redelegated_trust_id,
|
|
388
|
+
self.trust.redelegation_count,
|
|
389
|
+
self.trust.remaining_uses,
|
|
390
|
+
self.trust.roles,
|
|
391
|
+
self.trust.trustee_user_id,
|
|
392
|
+
self.trust.trustor_user_id,
|
|
411
393
|
)
|
|
412
394
|
self.assertEqual(datalist, data)
|
|
@@ -55,6 +55,7 @@ class TestImageCreate(TestImage):
|
|
|
55
55
|
self.new_image = image_fakes.create_one_image()
|
|
56
56
|
self.image_client.create_image.return_value = self.new_image
|
|
57
57
|
self.image_client.update_image.return_value = self.new_image
|
|
58
|
+
self.image_client.get_image.return_value = self.new_image
|
|
58
59
|
|
|
59
60
|
self.project_mock.get.return_value = self.project
|
|
60
61
|
|
|
@@ -89,6 +90,7 @@ class TestImageCreate(TestImage):
|
|
|
89
90
|
container_format=_image.DEFAULT_CONTAINER_FORMAT,
|
|
90
91
|
disk_format=_image.DEFAULT_DISK_FORMAT,
|
|
91
92
|
)
|
|
93
|
+
self.image_client.get_image.assert_called_once_with(self.new_image)
|
|
92
94
|
|
|
93
95
|
self.assertEqual(self.expected_columns, columns)
|
|
94
96
|
self.assertCountEqual(self.expected_data, data)
|
|
@@ -146,6 +148,7 @@ class TestImageCreate(TestImage):
|
|
|
146
148
|
is_protected=self.new_image.is_protected,
|
|
147
149
|
visibility=self.new_image.visibility,
|
|
148
150
|
)
|
|
151
|
+
self.image_client.get_image.assert_called_once_with(self.new_image)
|
|
149
152
|
|
|
150
153
|
self.assertEqual(self.expected_columns, columns)
|
|
151
154
|
self.assertCountEqual(self.expected_data, data)
|
|
@@ -243,6 +246,7 @@ class TestImageCreate(TestImage):
|
|
|
243
246
|
tags=self.new_image.tags,
|
|
244
247
|
filename=imagefile.name,
|
|
245
248
|
)
|
|
249
|
+
self.image_client.get_image.assert_called_once_with(self.new_image)
|
|
246
250
|
|
|
247
251
|
self.assertEqual(self.expected_columns, columns)
|
|
248
252
|
self.assertCountEqual(self.expected_data, data)
|
|
@@ -275,6 +279,7 @@ class TestImageCreate(TestImage):
|
|
|
275
279
|
data=fake_stdin,
|
|
276
280
|
validate_checksum=False,
|
|
277
281
|
)
|
|
282
|
+
self.image_client.get_image.assert_called_once_with(self.new_image)
|
|
278
283
|
|
|
279
284
|
self.assertEqual(self.expected_columns, columns)
|
|
280
285
|
self.assertCountEqual(self.expected_data, data)
|
|
@@ -315,6 +320,7 @@ class TestImageCreate(TestImage):
|
|
|
315
320
|
disk_format=_image.DEFAULT_DISK_FORMAT,
|
|
316
321
|
use_import=True,
|
|
317
322
|
)
|
|
323
|
+
self.image_client.get_image.assert_called_once_with(self.new_image)
|
|
318
324
|
|
|
319
325
|
@mock.patch('osc_lib.utils.find_resource')
|
|
320
326
|
@mock.patch('openstackclient.image.v2.image.get_data_from_stdin')
|
|
@@ -1419,6 +1419,7 @@ def create_one_network(attrs=None):
|
|
|
1419
1419
|
'availability_zone_hints': [],
|
|
1420
1420
|
'is_default': False,
|
|
1421
1421
|
'is_vlan_transparent': True,
|
|
1422
|
+
'is_vlan_qinq': False,
|
|
1422
1423
|
'port_security_enabled': True,
|
|
1423
1424
|
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
|
|
1424
1425
|
'ipv4_address_scope': 'ipv4' + uuid.uuid4().hex,
|
|
@@ -1676,8 +1677,10 @@ def create_one_port(attrs=None):
|
|
|
1676
1677
|
'qos_network_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
|
|
1677
1678
|
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
|
|
1678
1679
|
'tags': [],
|
|
1680
|
+
'trusted': None,
|
|
1679
1681
|
'propagate_uplink_status': False,
|
|
1680
1682
|
'location': 'MUNCHMUNCHMUNCH',
|
|
1683
|
+
'trunk_details': {},
|
|
1681
1684
|
}
|
|
1682
1685
|
|
|
1683
1686
|
# Overwrite default attributes.
|
|
@@ -63,6 +63,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
63
63
|
'ipv6_address_scope',
|
|
64
64
|
'is_default',
|
|
65
65
|
'is_vlan_transparent',
|
|
66
|
+
'is_vlan_qinq',
|
|
66
67
|
'mtu',
|
|
67
68
|
'name',
|
|
68
69
|
'port_security_enabled',
|
|
@@ -103,6 +104,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
103
104
|
network.RouterExternalColumn(_network.is_router_external),
|
|
104
105
|
_network.is_shared,
|
|
105
106
|
_network.is_vlan_transparent,
|
|
107
|
+
_network.is_vlan_qinq,
|
|
106
108
|
_network.status,
|
|
107
109
|
_network.segments,
|
|
108
110
|
format_columns.ListColumn(_network.subnet_ids),
|
|
@@ -190,6 +192,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
190
192
|
"--qos-policy",
|
|
191
193
|
self.qos_policy.id,
|
|
192
194
|
"--transparent-vlan",
|
|
195
|
+
"--no-qinq-vlan",
|
|
193
196
|
"--enable-port-security",
|
|
194
197
|
"--dns-domain",
|
|
195
198
|
"example.org.",
|
|
@@ -210,6 +213,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
210
213
|
('segmentation_id', '400'),
|
|
211
214
|
('qos_policy', self.qos_policy.id),
|
|
212
215
|
('transparent_vlan', True),
|
|
216
|
+
('qinq_vlan', False),
|
|
213
217
|
('enable_port_security', True),
|
|
214
218
|
('name', self._network.name),
|
|
215
219
|
('dns_domain', 'example.org.'),
|
|
@@ -234,6 +238,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
234
238
|
'provider:segmentation_id': '400',
|
|
235
239
|
'qos_policy_id': self.qos_policy.id,
|
|
236
240
|
'vlan_transparent': True,
|
|
241
|
+
'vlan_qinq': False,
|
|
237
242
|
'port_security_enabled': True,
|
|
238
243
|
'dns_domain': 'example.org.',
|
|
239
244
|
}
|
|
@@ -246,6 +251,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
246
251
|
"--enable",
|
|
247
252
|
"--no-share",
|
|
248
253
|
"--disable-port-security",
|
|
254
|
+
"--qinq-vlan",
|
|
249
255
|
self._network.name,
|
|
250
256
|
]
|
|
251
257
|
verifylist = [
|
|
@@ -253,6 +259,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
253
259
|
('no_share', True),
|
|
254
260
|
('name', self._network.name),
|
|
255
261
|
('external', False),
|
|
262
|
+
('qinq_vlan', True),
|
|
256
263
|
('disable_port_security', True),
|
|
257
264
|
]
|
|
258
265
|
|
|
@@ -264,6 +271,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
264
271
|
'admin_state_up': True,
|
|
265
272
|
'name': self._network.name,
|
|
266
273
|
'shared': False,
|
|
274
|
+
'vlan_qinq': True,
|
|
267
275
|
'port_security_enabled': False,
|
|
268
276
|
}
|
|
269
277
|
)
|
|
@@ -309,6 +317,19 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|
|
309
317
|
def test_create_with_no_tag(self):
|
|
310
318
|
self._test_create_with_tag(add_tags=False)
|
|
311
319
|
|
|
320
|
+
def test_create_with_vlan_qinq_and_transparency_enabled(self):
|
|
321
|
+
arglist = [
|
|
322
|
+
"--transparent-vlan",
|
|
323
|
+
"--qinq-vlan",
|
|
324
|
+
self._network.name,
|
|
325
|
+
]
|
|
326
|
+
verifylist = []
|
|
327
|
+
|
|
328
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
329
|
+
self.assertRaises(
|
|
330
|
+
exceptions.CommandError, self.cmd.take_action, parsed_args
|
|
331
|
+
)
|
|
332
|
+
|
|
312
333
|
|
|
313
334
|
class TestCreateNetworkIdentityV2(
|
|
314
335
|
identity_fakes_v2.FakeClientMixin,
|
|
@@ -332,6 +353,7 @@ class TestCreateNetworkIdentityV2(
|
|
|
332
353
|
'ipv6_address_scope',
|
|
333
354
|
'is_default',
|
|
334
355
|
'is_vlan_transparent',
|
|
356
|
+
'is_vlan_qinq',
|
|
335
357
|
'mtu',
|
|
336
358
|
'name',
|
|
337
359
|
'port_security_enabled',
|
|
@@ -372,6 +394,7 @@ class TestCreateNetworkIdentityV2(
|
|
|
372
394
|
network.RouterExternalColumn(_network.is_router_external),
|
|
373
395
|
_network.is_shared,
|
|
374
396
|
_network.is_vlan_transparent,
|
|
397
|
+
_network.is_vlan_qinq,
|
|
375
398
|
_network.status,
|
|
376
399
|
_network.segments,
|
|
377
400
|
format_columns.ListColumn(_network.subnet_ids),
|
|
@@ -1149,6 +1172,7 @@ class TestShowNetwork(TestNetwork):
|
|
|
1149
1172
|
'ipv6_address_scope',
|
|
1150
1173
|
'is_default',
|
|
1151
1174
|
'is_vlan_transparent',
|
|
1175
|
+
'is_vlan_qinq',
|
|
1152
1176
|
'mtu',
|
|
1153
1177
|
'name',
|
|
1154
1178
|
'port_security_enabled',
|
|
@@ -1189,6 +1213,7 @@ class TestShowNetwork(TestNetwork):
|
|
|
1189
1213
|
network.RouterExternalColumn(_network.is_router_external),
|
|
1190
1214
|
_network.is_shared,
|
|
1191
1215
|
_network.is_vlan_transparent,
|
|
1216
|
+
_network.is_vlan_qinq,
|
|
1192
1217
|
_network.status,
|
|
1193
1218
|
_network.segments,
|
|
1194
1219
|
format_columns.ListColumn(_network.subnet_ids),
|