python-openstackclient 8.0.0__py3-none-any.whl → 8.1.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/compute/client.py +5 -0
- openstackclient/compute/v2/console.py +7 -0
- openstackclient/compute/v2/console_connection.py +48 -0
- openstackclient/compute/v2/keypair.py +10 -3
- openstackclient/compute/v2/server.py +75 -10
- openstackclient/compute/v2/server_event.py +1 -1
- openstackclient/identity/common.py +79 -0
- openstackclient/identity/v3/application_credential.py +2 -2
- openstackclient/identity/v3/domain.py +62 -43
- openstackclient/identity/v3/group.py +113 -68
- openstackclient/identity/v3/project.py +17 -0
- openstackclient/identity/v3/user.py +38 -5
- openstackclient/image/client.py +5 -0
- openstackclient/image/v2/image.py +11 -11
- openstackclient/network/client.py +0 -6
- openstackclient/network/v2/floating_ip.py +58 -29
- openstackclient/network/v2/network_qos_rule.py +3 -11
- openstackclient/network/v2/router.py +1 -1
- openstackclient/network/v2/security_group.py +5 -4
- openstackclient/network/v2/security_group_rule.py +1 -1
- openstackclient/shell.py +1 -1
- openstackclient/tests/functional/base.py +5 -1
- openstackclient/tests/functional/compute/v2/test_keypair.py +41 -5
- openstackclient/tests/unit/compute/v2/fakes.py +81 -305
- openstackclient/tests/unit/compute/v2/test_console.py +18 -1
- openstackclient/tests/unit/compute/v2/test_console_connection.py +72 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +1 -1
- openstackclient/tests/unit/compute/v2/test_keypair.py +12 -5
- openstackclient/tests/unit/compute/v2/test_server.py +169 -46
- openstackclient/tests/unit/compute/v2/test_server_backup.py +32 -71
- openstackclient/tests/unit/compute/v2/test_server_event.py +2 -2
- openstackclient/tests/unit/compute/v2/test_server_image.py +33 -72
- openstackclient/tests/unit/compute/v2/test_server_migration.py +4 -4
- openstackclient/tests/unit/identity/v3/test_application_credential.py +47 -25
- openstackclient/tests/unit/identity/v3/test_domain.py +115 -105
- openstackclient/tests/unit/identity/v3/test_group.py +353 -202
- openstackclient/tests/unit/identity/v3/test_project.py +16 -0
- openstackclient/tests/unit/identity/v3/test_user.py +86 -6
- openstackclient/tests/unit/image/v1/test_image.py +8 -9
- openstackclient/tests/unit/image/v2/test_image.py +49 -49
- openstackclient/tests/unit/network/v2/fakes.py +405 -485
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +13 -19
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +2 -2
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +1 -3
- openstackclient/tests/unit/network/v2/test_network.py +4 -4
- openstackclient/tests/unit/network/v2/test_network_agent.py +15 -29
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +16 -19
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +79 -152
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +4 -6
- openstackclient/tests/unit/network/v2/test_network_rbac.py +2 -2
- openstackclient/tests/unit/network/v2/test_port.py +17 -17
- openstackclient/tests/unit/network/v2/test_router.py +73 -57
- openstackclient/tests/unit/network/v2/test_security_group_network.py +25 -27
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +1 -3
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +33 -39
- openstackclient/tests/unit/volume/v2/fakes.py +1 -2
- openstackclient/tests/unit/volume/v2/test_service.py +57 -91
- openstackclient/tests/unit/volume/v2/test_volume.py +108 -105
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +141 -148
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +293 -283
- openstackclient/tests/unit/volume/v3/test_block_storage_log_level.py +61 -71
- openstackclient/tests/unit/volume/v3/test_service.py +221 -141
- openstackclient/tests/unit/volume/v3/test_volume.py +130 -119
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +198 -203
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +682 -47
- openstackclient/volume/v2/service.py +41 -38
- openstackclient/volume/v2/volume.py +63 -37
- openstackclient/volume/v2/volume_backup.py +9 -3
- openstackclient/volume/v2/volume_snapshot.py +121 -84
- openstackclient/volume/v3/block_storage_log_level.py +22 -28
- openstackclient/volume/v3/service.py +105 -14
- openstackclient/volume/v3/volume.py +200 -39
- openstackclient/volume/v3/volume_backup.py +24 -19
- openstackclient/volume/v3/volume_snapshot.py +485 -10
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/AUTHORS +8 -0
- python_openstackclient-8.1.0.dist-info/METADATA +264 -0
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/RECORD +83 -81
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/entry_points.txt +7 -6
- python_openstackclient-8.1.0.dist-info/pbr.json +1 -0
- python_openstackclient-8.0.0.dist-info/METADATA +0 -166
- python_openstackclient-8.0.0.dist-info/pbr.json +0 -1
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/top_level.txt +0 -0
|
@@ -383,7 +383,6 @@ class TestListSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
|
|
383
383
|
_security_group_rule_tcp = compute_fakes.create_one_security_group_rule(
|
|
384
384
|
{
|
|
385
385
|
'ip_protocol': 'tcp',
|
|
386
|
-
'ethertype': 'IPv4',
|
|
387
386
|
'from_port': 80,
|
|
388
387
|
'to_port': 80,
|
|
389
388
|
'group': {'name': _security_group['name']},
|
|
@@ -392,7 +391,6 @@ class TestListSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
|
|
392
391
|
_security_group_rule_icmp = compute_fakes.create_one_security_group_rule(
|
|
393
392
|
{
|
|
394
393
|
'ip_protocol': 'icmp',
|
|
395
|
-
'ethertype': 'IPv4',
|
|
396
394
|
'from_port': -1,
|
|
397
395
|
'to_port': -1,
|
|
398
396
|
'ip_range': {'cidr': '10.0.2.0/24'},
|
|
@@ -426,7 +424,7 @@ class TestListSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
|
|
426
424
|
expected_rule_with_group = (
|
|
427
425
|
rule['id'],
|
|
428
426
|
rule['ip_protocol'],
|
|
429
|
-
|
|
427
|
+
'', # ethertype is a neutron-only thing
|
|
430
428
|
rule['ip_range'],
|
|
431
429
|
rule['port_range'],
|
|
432
430
|
rule['remote_security_group'],
|
|
@@ -40,14 +40,13 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
40
40
|
_security_group_rule = None
|
|
41
41
|
|
|
42
42
|
# The security group that will contain the rule created.
|
|
43
|
-
_security_group = (
|
|
44
|
-
network_fakes.FakeSecurityGroup.create_one_security_group()
|
|
45
|
-
)
|
|
43
|
+
_security_group = network_fakes.create_one_security_group()
|
|
46
44
|
|
|
47
45
|
# The address group to be used in security group rules
|
|
48
46
|
_address_group = network_fakes.create_one_address_group()
|
|
49
47
|
|
|
50
48
|
expected_columns = (
|
|
49
|
+
'created_at',
|
|
51
50
|
'description',
|
|
52
51
|
'direction',
|
|
53
52
|
'ether_type',
|
|
@@ -59,21 +58,22 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
59
58
|
'remote_address_group_id',
|
|
60
59
|
'remote_group_id',
|
|
61
60
|
'remote_ip_prefix',
|
|
61
|
+
'revision_number',
|
|
62
62
|
'security_group_id',
|
|
63
|
+
'updated_at',
|
|
63
64
|
)
|
|
64
65
|
|
|
65
66
|
expected_data = None
|
|
66
67
|
|
|
67
68
|
def _setup_security_group_rule(self, attrs=None):
|
|
68
69
|
self._security_group_rule = (
|
|
69
|
-
network_fakes.
|
|
70
|
-
attrs
|
|
71
|
-
)
|
|
70
|
+
network_fakes.create_one_security_group_rule(attrs)
|
|
72
71
|
)
|
|
73
72
|
self.network_client.create_security_group_rule = mock.Mock(
|
|
74
73
|
return_value=self._security_group_rule
|
|
75
74
|
)
|
|
76
75
|
self.expected_data = (
|
|
76
|
+
self._security_group_rule.created_at,
|
|
77
77
|
self._security_group_rule.description,
|
|
78
78
|
self._security_group_rule.direction,
|
|
79
79
|
self._security_group_rule.ether_type,
|
|
@@ -85,7 +85,9 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
85
85
|
self._security_group_rule.remote_address_group_id,
|
|
86
86
|
self._security_group_rule.remote_group_id,
|
|
87
87
|
self._security_group_rule.remote_ip_prefix,
|
|
88
|
+
self._security_group_rule.revision_number,
|
|
88
89
|
self._security_group_rule.security_group_id,
|
|
90
|
+
self._security_group_rule.updated_at,
|
|
89
91
|
)
|
|
90
92
|
|
|
91
93
|
def setUp(self):
|
|
@@ -963,11 +965,7 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
963
965
|
|
|
964
966
|
class TestDeleteSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
965
967
|
# The security group rules to be deleted.
|
|
966
|
-
_security_group_rules = (
|
|
967
|
-
network_fakes.FakeSecurityGroupRule.create_security_group_rules(
|
|
968
|
-
count=2
|
|
969
|
-
)
|
|
970
|
-
)
|
|
968
|
+
_security_group_rules = network_fakes.create_security_group_rules(count=2)
|
|
971
969
|
|
|
972
970
|
def setUp(self):
|
|
973
971
|
super().setUp()
|
|
@@ -977,9 +975,7 @@ class TestDeleteSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
977
975
|
)
|
|
978
976
|
|
|
979
977
|
self.network_client.find_security_group_rule = (
|
|
980
|
-
network_fakes.
|
|
981
|
-
self._security_group_rules
|
|
982
|
-
)
|
|
978
|
+
network_fakes.get_security_group_rules(self._security_group_rules)
|
|
983
979
|
)
|
|
984
980
|
|
|
985
981
|
# Get the command object to test
|
|
@@ -1057,33 +1053,27 @@ class TestDeleteSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
1057
1053
|
|
|
1058
1054
|
class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
1059
1055
|
# The security group to hold the rules.
|
|
1060
|
-
_security_group = (
|
|
1061
|
-
network_fakes.FakeSecurityGroup.create_one_security_group()
|
|
1062
|
-
)
|
|
1056
|
+
_security_group = network_fakes.create_one_security_group()
|
|
1063
1057
|
|
|
1064
1058
|
# The security group rule to be listed.
|
|
1065
|
-
_security_group_rule_tcp = (
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
}
|
|
1073
|
-
)
|
|
1059
|
+
_security_group_rule_tcp = network_fakes.create_one_security_group_rule(
|
|
1060
|
+
{
|
|
1061
|
+
'protocol': 'tcp',
|
|
1062
|
+
'port_range_max': 80,
|
|
1063
|
+
'port_range_min': 80,
|
|
1064
|
+
'security_group_id': _security_group.id,
|
|
1065
|
+
}
|
|
1074
1066
|
)
|
|
1075
|
-
_security_group_rule_icmp = (
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
}
|
|
1082
|
-
)
|
|
1067
|
+
_security_group_rule_icmp = network_fakes.create_one_security_group_rule(
|
|
1068
|
+
{
|
|
1069
|
+
'protocol': 'icmp',
|
|
1070
|
+
'remote_ip_prefix': '10.0.2.0/24',
|
|
1071
|
+
'security_group_id': _security_group.id,
|
|
1072
|
+
}
|
|
1083
1073
|
)
|
|
1084
1074
|
_security_group.security_group_rules = [
|
|
1085
|
-
_security_group_rule_tcp
|
|
1086
|
-
_security_group_rule_icmp
|
|
1075
|
+
dict(_security_group_rule_tcp),
|
|
1076
|
+
dict(_security_group_rule_icmp),
|
|
1087
1077
|
]
|
|
1088
1078
|
_security_group_rules = [
|
|
1089
1079
|
_security_group_rule_tcp,
|
|
@@ -1264,11 +1254,10 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
1264
1254
|
|
|
1265
1255
|
class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
1266
1256
|
# The security group rule to be shown.
|
|
1267
|
-
_security_group_rule = (
|
|
1268
|
-
network_fakes.FakeSecurityGroupRule.create_one_security_group_rule()
|
|
1269
|
-
)
|
|
1257
|
+
_security_group_rule = network_fakes.create_one_security_group_rule()
|
|
1270
1258
|
|
|
1271
1259
|
columns = (
|
|
1260
|
+
'created_at',
|
|
1272
1261
|
'description',
|
|
1273
1262
|
'direction',
|
|
1274
1263
|
'ether_type',
|
|
@@ -1280,10 +1269,13 @@ class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
1280
1269
|
'remote_address_group_id',
|
|
1281
1270
|
'remote_group_id',
|
|
1282
1271
|
'remote_ip_prefix',
|
|
1272
|
+
'revision_number',
|
|
1283
1273
|
'security_group_id',
|
|
1274
|
+
'updated_at',
|
|
1284
1275
|
)
|
|
1285
1276
|
|
|
1286
1277
|
data = (
|
|
1278
|
+
_security_group_rule.created_at,
|
|
1287
1279
|
_security_group_rule.description,
|
|
1288
1280
|
_security_group_rule.direction,
|
|
1289
1281
|
_security_group_rule.ether_type,
|
|
@@ -1295,7 +1287,9 @@ class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
|
|
1295
1287
|
_security_group_rule.remote_address_group_id,
|
|
1296
1288
|
_security_group_rule.remote_group_id,
|
|
1297
1289
|
_security_group_rule.remote_ip_prefix,
|
|
1290
|
+
_security_group_rule.revision_number,
|
|
1298
1291
|
_security_group_rule.security_group_id,
|
|
1292
|
+
_security_group_rule.updated_at,
|
|
1299
1293
|
)
|
|
1300
1294
|
|
|
1301
1295
|
def setUp(self):
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
|
|
15
15
|
import copy
|
|
16
16
|
import random
|
|
17
|
-
import typing as ty
|
|
18
17
|
from unittest import mock
|
|
19
18
|
import uuid
|
|
20
19
|
|
|
@@ -92,7 +91,7 @@ class FakeClientMixin:
|
|
|
92
91
|
self.volume_sdk_client = self.app.client_manager.sdk_connection.volume
|
|
93
92
|
self.set_volume_api_version() # default to the lowest
|
|
94
93
|
|
|
95
|
-
def set_volume_api_version(self, version:
|
|
94
|
+
def set_volume_api_version(self, version: str | None = None):
|
|
96
95
|
"""Set a fake block storage API version.
|
|
97
96
|
|
|
98
97
|
:param version: The fake microversion to "support". This must be None
|
|
@@ -12,108 +12,83 @@
|
|
|
12
12
|
# under the License.
|
|
13
13
|
#
|
|
14
14
|
|
|
15
|
+
from unittest import mock
|
|
16
|
+
|
|
17
|
+
from openstack.block_storage.v2 import service as _service
|
|
18
|
+
from openstack.test import fakes as sdk_fakes
|
|
15
19
|
from osc_lib import exceptions
|
|
16
20
|
|
|
17
21
|
from openstackclient.tests.unit.volume.v2 import fakes as volume_fakes
|
|
18
22
|
from openstackclient.volume.v2 import service
|
|
19
23
|
|
|
20
24
|
|
|
21
|
-
class
|
|
25
|
+
class TestServiceList(volume_fakes.TestVolume):
|
|
22
26
|
def setUp(self):
|
|
23
27
|
super().setUp()
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
self.
|
|
27
|
-
self.service_mock.reset_mock()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class TestServiceList(TestService):
|
|
31
|
-
# The service to be listed
|
|
32
|
-
services = volume_fakes.create_one_service()
|
|
29
|
+
self.service = sdk_fakes.generate_fake_resource(_service.Service)
|
|
30
|
+
self.volume_sdk_client.services.return_value = [self.service]
|
|
33
31
|
|
|
34
|
-
def setUp(self):
|
|
35
|
-
super().setUp()
|
|
36
|
-
|
|
37
|
-
self.service_mock.list.return_value = [self.services]
|
|
38
|
-
|
|
39
|
-
# Get the command object to test
|
|
40
32
|
self.cmd = service.ListService(self.app, None)
|
|
41
33
|
|
|
42
34
|
def test_service_list(self):
|
|
43
35
|
arglist = [
|
|
44
36
|
'--host',
|
|
45
|
-
self.
|
|
37
|
+
self.service.host,
|
|
46
38
|
'--service',
|
|
47
|
-
self.
|
|
39
|
+
self.service.binary,
|
|
48
40
|
]
|
|
49
41
|
verifylist = [
|
|
50
|
-
('host', self.
|
|
51
|
-
('service', self.
|
|
42
|
+
('host', self.service.host),
|
|
43
|
+
('service', self.service.binary),
|
|
52
44
|
]
|
|
53
45
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
54
46
|
|
|
55
|
-
# In base command class Lister in cliff, abstract method take_action()
|
|
56
|
-
# returns a tuple containing the column names and an iterable
|
|
57
|
-
# containing the data to be listed.
|
|
58
47
|
columns, data = self.cmd.take_action(parsed_args)
|
|
59
48
|
|
|
60
|
-
expected_columns =
|
|
49
|
+
expected_columns = (
|
|
61
50
|
'Binary',
|
|
62
51
|
'Host',
|
|
63
52
|
'Zone',
|
|
64
53
|
'Status',
|
|
65
54
|
'State',
|
|
66
55
|
'Updated At',
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# confirming if all expected columns are present in the result.
|
|
70
|
-
self.assertEqual(expected_columns, columns)
|
|
71
|
-
|
|
56
|
+
)
|
|
72
57
|
datalist = (
|
|
73
58
|
(
|
|
74
|
-
self.
|
|
75
|
-
self.
|
|
76
|
-
self.
|
|
77
|
-
self.
|
|
78
|
-
self.
|
|
79
|
-
self.
|
|
59
|
+
self.service.binary,
|
|
60
|
+
self.service.host,
|
|
61
|
+
self.service.availability_zone,
|
|
62
|
+
self.service.status,
|
|
63
|
+
self.service.state,
|
|
64
|
+
self.service.updated_at,
|
|
80
65
|
),
|
|
81
66
|
)
|
|
82
|
-
|
|
83
|
-
# confirming if all expected values are present in the result.
|
|
67
|
+
self.assertEqual(expected_columns, columns)
|
|
84
68
|
self.assertEqual(datalist, tuple(data))
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
self.services.host,
|
|
89
|
-
self.services.binary,
|
|
69
|
+
self.volume_sdk_client.services.assert_called_with(
|
|
70
|
+
host=self.service.host,
|
|
71
|
+
binary=self.service.binary,
|
|
90
72
|
)
|
|
91
73
|
|
|
92
|
-
# checking if prohibited columns are present in output
|
|
93
|
-
self.assertNotIn("Disabled Reason", columns)
|
|
94
|
-
self.assertNotIn(self.services.disabled_reason, tuple(data))
|
|
95
|
-
|
|
96
74
|
def test_service_list_with_long_option(self):
|
|
97
75
|
arglist = [
|
|
98
76
|
'--host',
|
|
99
|
-
self.
|
|
77
|
+
self.service.host,
|
|
100
78
|
'--service',
|
|
101
|
-
self.
|
|
79
|
+
self.service.binary,
|
|
102
80
|
'--long',
|
|
103
81
|
]
|
|
104
82
|
verifylist = [
|
|
105
|
-
('host', self.
|
|
106
|
-
('service', self.
|
|
83
|
+
('host', self.service.host),
|
|
84
|
+
('service', self.service.binary),
|
|
107
85
|
('long', True),
|
|
108
86
|
]
|
|
109
87
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
110
88
|
|
|
111
|
-
# In base command class Lister in cliff, abstract method take_action()
|
|
112
|
-
# returns a tuple containing the column names and an iterable
|
|
113
|
-
# containing the data to be listed.
|
|
114
89
|
columns, data = self.cmd.take_action(parsed_args)
|
|
115
90
|
|
|
116
|
-
expected_columns =
|
|
91
|
+
expected_columns = (
|
|
117
92
|
'Binary',
|
|
118
93
|
'Host',
|
|
119
94
|
'Zone',
|
|
@@ -121,41 +96,34 @@ class TestServiceList(TestService):
|
|
|
121
96
|
'State',
|
|
122
97
|
'Updated At',
|
|
123
98
|
'Disabled Reason',
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
# confirming if all expected columns are present in the result.
|
|
127
|
-
self.assertEqual(expected_columns, columns)
|
|
128
|
-
|
|
99
|
+
)
|
|
129
100
|
datalist = (
|
|
130
101
|
(
|
|
131
|
-
self.
|
|
132
|
-
self.
|
|
133
|
-
self.
|
|
134
|
-
self.
|
|
135
|
-
self.
|
|
136
|
-
self.
|
|
137
|
-
self.
|
|
102
|
+
self.service.binary,
|
|
103
|
+
self.service.host,
|
|
104
|
+
self.service.availability_zone,
|
|
105
|
+
self.service.status,
|
|
106
|
+
self.service.state,
|
|
107
|
+
self.service.updated_at,
|
|
108
|
+
self.service.disabled_reason,
|
|
138
109
|
),
|
|
139
110
|
)
|
|
140
|
-
|
|
141
|
-
# confirming if all expected values are present in the result.
|
|
111
|
+
self.assertEqual(expected_columns, columns)
|
|
142
112
|
self.assertEqual(datalist, tuple(data))
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
self.
|
|
146
|
-
self.services.binary,
|
|
113
|
+
self.volume_sdk_client.services.assert_called_with(
|
|
114
|
+
host=self.service.host,
|
|
115
|
+
binary=self.service.binary,
|
|
147
116
|
)
|
|
148
117
|
|
|
149
118
|
|
|
150
|
-
class TestServiceSet(
|
|
151
|
-
service = volume_fakes.create_one_service()
|
|
152
|
-
|
|
119
|
+
class TestServiceSet(volume_fakes.TestVolume):
|
|
153
120
|
def setUp(self):
|
|
154
121
|
super().setUp()
|
|
155
122
|
|
|
156
|
-
self.
|
|
157
|
-
self.
|
|
158
|
-
self.
|
|
123
|
+
self.service = sdk_fakes.generate_fake_resource(_service.Service)
|
|
124
|
+
self.service.enable = mock.Mock(autospec=True)
|
|
125
|
+
self.service.disable = mock.Mock(autospec=True)
|
|
126
|
+
self.volume_sdk_client.find_service.return_value = self.service
|
|
159
127
|
|
|
160
128
|
self.cmd = service.SetService(self.app, None)
|
|
161
129
|
|
|
@@ -171,9 +139,8 @@ class TestServiceSet(TestService):
|
|
|
171
139
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
172
140
|
result = self.cmd.take_action(parsed_args)
|
|
173
141
|
|
|
174
|
-
self.
|
|
175
|
-
self.
|
|
176
|
-
self.service_mock.disable_log_reason.assert_not_called()
|
|
142
|
+
self.service.enable.assert_not_called()
|
|
143
|
+
self.service.disable.assert_not_called()
|
|
177
144
|
self.assertIsNone(result)
|
|
178
145
|
|
|
179
146
|
def test_service_set_enable(self):
|
|
@@ -191,11 +158,8 @@ class TestServiceSet(TestService):
|
|
|
191
158
|
|
|
192
159
|
result = self.cmd.take_action(parsed_args)
|
|
193
160
|
|
|
194
|
-
self.
|
|
195
|
-
|
|
196
|
-
)
|
|
197
|
-
self.service_mock.disable.assert_not_called()
|
|
198
|
-
self.service_mock.disable_log_reason.assert_not_called()
|
|
161
|
+
self.service.enable.assert_called_with(self.volume_sdk_client)
|
|
162
|
+
self.service.disable.assert_not_called()
|
|
199
163
|
self.assertIsNone(result)
|
|
200
164
|
|
|
201
165
|
def test_service_set_disable(self):
|
|
@@ -213,11 +177,10 @@ class TestServiceSet(TestService):
|
|
|
213
177
|
|
|
214
178
|
result = self.cmd.take_action(parsed_args)
|
|
215
179
|
|
|
216
|
-
self.
|
|
217
|
-
|
|
180
|
+
self.service.enable.assert_not_called()
|
|
181
|
+
self.service.disable.assert_called_with(
|
|
182
|
+
self.volume_sdk_client, reason=None
|
|
218
183
|
)
|
|
219
|
-
self.service_mock.enable.assert_not_called()
|
|
220
|
-
self.service_mock.disable_log_reason.assert_not_called()
|
|
221
184
|
self.assertIsNone(result)
|
|
222
185
|
|
|
223
186
|
def test_service_set_disable_with_reason(self):
|
|
@@ -239,8 +202,9 @@ class TestServiceSet(TestService):
|
|
|
239
202
|
|
|
240
203
|
result = self.cmd.take_action(parsed_args)
|
|
241
204
|
|
|
242
|
-
self.
|
|
243
|
-
|
|
205
|
+
self.service.enable.assert_not_called()
|
|
206
|
+
self.service.disable.assert_called_with(
|
|
207
|
+
self.volume_sdk_client, reason=reason
|
|
244
208
|
)
|
|
245
209
|
self.assertIsNone(result)
|
|
246
210
|
|
|
@@ -258,6 +222,7 @@ class TestServiceSet(TestService):
|
|
|
258
222
|
('service', self.service.binary),
|
|
259
223
|
]
|
|
260
224
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
225
|
+
|
|
261
226
|
try:
|
|
262
227
|
self.cmd.take_action(parsed_args)
|
|
263
228
|
self.fail("CommandError should be raised.")
|
|
@@ -284,6 +249,7 @@ class TestServiceSet(TestService):
|
|
|
284
249
|
('service', self.service.binary),
|
|
285
250
|
]
|
|
286
251
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
252
|
+
|
|
287
253
|
try:
|
|
288
254
|
self.cmd.take_action(parsed_args)
|
|
289
255
|
self.fail("CommandError should be raised.")
|