python-openstackclient 7.4.0__py3-none-any.whl → 8.0.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 +3 -6
- openstackclient/common/clientmanager.py +2 -1
- openstackclient/common/envvars.py +57 -0
- openstackclient/common/extension.py +3 -11
- openstackclient/common/limits.py +1 -1
- openstackclient/common/project_cleanup.py +3 -2
- openstackclient/common/quota.py +54 -28
- openstackclient/compute/client.py +2 -5
- openstackclient/compute/v2/agent.py +5 -5
- openstackclient/compute/v2/aggregate.py +17 -15
- openstackclient/compute/v2/console.py +3 -4
- openstackclient/compute/v2/flavor.py +14 -18
- openstackclient/compute/v2/host.py +3 -3
- openstackclient/compute/v2/hypervisor.py +10 -4
- openstackclient/compute/v2/hypervisor_stats.py +1 -1
- openstackclient/compute/v2/keypair.py +8 -10
- openstackclient/compute/v2/server.py +70 -112
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_event.py +7 -16
- openstackclient/compute/v2/server_group.py +6 -6
- openstackclient/compute/v2/server_image.py +1 -1
- openstackclient/compute/v2/server_migration.py +6 -6
- openstackclient/compute/v2/server_volume.py +4 -4
- openstackclient/compute/v2/service.py +9 -13
- openstackclient/compute/v2/usage.py +4 -6
- openstackclient/identity/client.py +2 -4
- openstackclient/identity/common.py +16 -17
- openstackclient/identity/v2_0/ec2creds.py +4 -3
- openstackclient/identity/v2_0/endpoint.py +12 -10
- openstackclient/identity/v2_0/project.py +6 -6
- openstackclient/identity/v2_0/role.py +1 -1
- openstackclient/identity/v2_0/service.py +7 -7
- openstackclient/identity/v2_0/user.py +6 -21
- openstackclient/identity/v3/access_rule.py +2 -5
- openstackclient/identity/v3/consumer.py +4 -3
- openstackclient/identity/v3/credential.py +6 -7
- openstackclient/identity/v3/domain.py +1 -1
- openstackclient/identity/v3/ec2creds.py +4 -3
- openstackclient/identity/v3/endpoint.py +104 -88
- openstackclient/identity/v3/endpoint_group.py +1 -1
- openstackclient/identity/v3/group.py +3 -4
- openstackclient/identity/v3/identity_provider.py +1 -2
- openstackclient/identity/v3/limit.py +4 -9
- openstackclient/identity/v3/mapping.py +4 -3
- openstackclient/identity/v3/policy.py +5 -8
- openstackclient/identity/v3/project.py +6 -6
- openstackclient/identity/v3/region.py +2 -5
- openstackclient/identity/v3/registered_limit.py +4 -8
- openstackclient/identity/v3/role.py +15 -16
- openstackclient/identity/v3/service.py +8 -8
- openstackclient/identity/v3/service_provider.py +3 -6
- openstackclient/identity/v3/tag.py +2 -2
- openstackclient/identity/v3/token.py +1 -2
- openstackclient/identity/v3/trust.py +74 -25
- openstackclient/identity/v3/user.py +9 -6
- openstackclient/image/client.py +2 -5
- openstackclient/image/v1/image.py +11 -15
- openstackclient/image/v2/cache.py +2 -4
- openstackclient/image/v2/image.py +30 -37
- openstackclient/image/v2/metadef_namespaces.py +4 -3
- openstackclient/image/v2/metadef_resource_type_association.py +1 -2
- openstackclient/image/v2/metadef_resource_types.py +1 -2
- openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +9 -1370
- openstackclient/network/client.py +4 -10
- openstackclient/network/common.py +16 -12
- openstackclient/network/utils.py +3 -3
- openstackclient/network/v2/address_group.py +5 -9
- openstackclient/network/v2/address_scope.py +2 -3
- openstackclient/network/v2/default_security_group_rule.py +1 -2
- openstackclient/network/v2/floating_ip.py +14 -21
- openstackclient/network/v2/floating_ip_port_forwarding.py +7 -7
- openstackclient/network/v2/ip_availability.py +1 -2
- openstackclient/network/v2/l3_conntrack_helper.py +8 -12
- openstackclient/network/v2/local_ip.py +24 -26
- openstackclient/network/v2/local_ip_association.py +4 -5
- openstackclient/network/v2/ndp_proxy.py +9 -10
- openstackclient/network/v2/network.py +12 -16
- openstackclient/network/v2/network_agent.py +29 -37
- openstackclient/network/v2/network_auto_allocated_topology.py +4 -5
- openstackclient/network/v2/network_flavor.py +1 -1
- openstackclient/network/v2/network_flavor_profile.py +5 -5
- openstackclient/network/v2/network_meter.py +3 -3
- openstackclient/network/v2/network_meter_rule.py +5 -8
- openstackclient/network/v2/network_qos_policy.py +4 -4
- openstackclient/network/v2/network_qos_rule.py +4 -5
- openstackclient/network/v2/network_rbac.py +4 -4
- openstackclient/network/v2/network_segment.py +6 -7
- openstackclient/network/v2/network_segment_range.py +16 -20
- openstackclient/network/v2/network_trunk.py +24 -16
- openstackclient/network/v2/port.py +28 -29
- openstackclient/network/v2/router.py +52 -41
- openstackclient/network/v2/security_group.py +8 -15
- openstackclient/network/v2/security_group_rule.py +9 -10
- openstackclient/network/v2/subnet.py +31 -30
- openstackclient/network/v2/subnet_pool.py +4 -4
- openstackclient/object/client.py +2 -3
- openstackclient/object/v1/container.py +2 -3
- openstackclient/object/v1/object.py +2 -9
- openstackclient/shell.py +22 -5
- openstackclient/tests/functional/base.py +2 -2
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +12 -6
- openstackclient/tests/functional/compute/v2/test_server.py +2 -3
- openstackclient/tests/functional/compute/v2/test_server_event.py +1 -1
- openstackclient/tests/functional/identity/v2/test_user.py +1 -1
- openstackclient/tests/functional/identity/v3/common.py +3 -8
- openstackclient/tests/functional/identity/v3/test_application_credential.py +10 -10
- openstackclient/tests/functional/identity/v3/test_endpoint.py +3 -3
- openstackclient/tests/functional/identity/v3/test_group.py +3 -3
- openstackclient/tests/functional/identity/v3/test_idp.py +3 -7
- openstackclient/tests/functional/identity/v3/test_limit.py +4 -4
- openstackclient/tests/functional/identity/v3/test_project.py +5 -14
- openstackclient/tests/functional/identity/v3/test_region.py +1 -3
- openstackclient/tests/functional/identity/v3/test_registered_limit.py +3 -3
- openstackclient/tests/functional/identity/v3/test_role.py +1 -1
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +13 -31
- openstackclient/tests/functional/identity/v3/test_service_provider.py +3 -7
- openstackclient/tests/functional/identity/v3/test_user.py +8 -8
- openstackclient/tests/functional/network/v2/common.py +7 -3
- openstackclient/tests/functional/network/v2/test_address_group.py +4 -0
- openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +15 -11
- openstackclient/tests/functional/network/v2/test_local_ip.py +4 -0
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +2 -2
- openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +2 -3
- openstackclient/tests/functional/network/v2/test_network_rbac.py +2 -2
- openstackclient/tests/functional/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/functional/network/v2/test_port.py +17 -7
- openstackclient/tests/functional/network/v2/test_router.py +42 -0
- openstackclient/tests/functional/network/v2/test_subnet_pool.py +4 -0
- openstackclient/tests/unit/api/test_compute_v2.py +67 -87
- openstackclient/tests/unit/common/test_availability_zone.py +6 -14
- openstackclient/tests/unit/common/test_command.py +1 -1
- openstackclient/tests/unit/common/test_extension.py +5 -7
- openstackclient/tests/unit/common/test_limits.py +1 -1
- openstackclient/tests/unit/common/test_project_cleanup.py +5 -6
- openstackclient/tests/unit/common/test_quota.py +51 -28
- openstackclient/tests/unit/compute/v2/fakes.py +4 -10
- openstackclient/tests/unit/compute/v2/test_agent.py +16 -16
- openstackclient/tests/unit/compute/v2/test_aggregate.py +56 -60
- openstackclient/tests/unit/compute/v2/test_console.py +16 -16
- openstackclient/tests/unit/compute/v2/test_flavor.py +71 -71
- openstackclient/tests/unit/compute/v2/test_host.py +8 -8
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +22 -30
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +24 -24
- openstackclient/tests/unit/compute/v2/test_server.py +524 -560
- openstackclient/tests/unit/compute/v2/test_server_backup.py +5 -7
- openstackclient/tests/unit/compute/v2/test_server_event.py +16 -18
- openstackclient/tests/unit/compute/v2/test_server_group.py +25 -31
- openstackclient/tests/unit/compute/v2/test_server_image.py +6 -8
- openstackclient/tests/unit/compute/v2/test_server_migration.py +37 -37
- openstackclient/tests/unit/compute/v2/test_server_volume.py +12 -12
- openstackclient/tests/unit/compute/v2/test_service.py +39 -45
- openstackclient/tests/unit/compute/v2/test_usage.py +5 -5
- openstackclient/tests/unit/identity/v2_0/fakes.py +1 -1
- openstackclient/tests/unit/identity/v3/test_access_rule.py +1 -3
- openstackclient/tests/unit/identity/v3/test_application_credential.py +1 -1
- openstackclient/tests/unit/identity/v3/test_endpoint.py +167 -172
- openstackclient/tests/unit/identity/v3/test_mappings.py +2 -2
- openstackclient/tests/unit/identity/v3/test_trust.py +5 -2
- openstackclient/tests/unit/identity/v3/test_user.py +16 -0
- openstackclient/tests/unit/image/v1/fakes.py +2 -2
- openstackclient/tests/unit/image/v2/test_image.py +39 -1
- openstackclient/tests/unit/integ/cli/test_shell.py +1 -2
- openstackclient/tests/unit/network/test_common.py +2 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +8 -14
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +49 -35
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_compute.py +11 -11
- openstackclient/tests/unit/network/v2/test_network_trunk.py +2 -2
- openstackclient/tests/unit/network/v2/test_port.py +4 -5
- openstackclient/tests/unit/network/v2/test_router.py +63 -0
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +11 -19
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +14 -14
- openstackclient/tests/unit/object/v1/test_object_all.py +4 -3
- openstackclient/tests/unit/test_shell.py +16 -13
- openstackclient/tests/unit/volume/v2/test_volume.py +1 -1
- openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +1 -1
- openstackclient/tests/unit/volume/v3/fakes.py +2 -8
- openstackclient/tests/unit/volume/v3/test_volume.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +3 -3
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +1 -2
- openstackclient/tests/unit/volume/v3/test_volume_transfer_request.py +1 -1
- openstackclient/volume/client.py +1 -3
- openstackclient/volume/v2/consistency_group.py +4 -8
- openstackclient/volume/v2/consistency_group_snapshot.py +1 -2
- openstackclient/volume/v2/qos_specs.py +1 -2
- openstackclient/volume/v2/volume.py +8 -16
- openstackclient/volume/v2/volume_backup.py +6 -7
- openstackclient/volume/v2/volume_snapshot.py +8 -9
- openstackclient/volume/v2/volume_transfer_request.py +0 -3
- openstackclient/volume/v2/volume_type.py +10 -21
- openstackclient/volume/v3/block_storage_cluster.py +3 -3
- openstackclient/volume/v3/block_storage_manage.py +1 -3
- openstackclient/volume/v3/volume.py +18 -19
- openstackclient/volume/v3/volume_attachment.py +3 -2
- openstackclient/volume/v3/volume_backup.py +7 -8
- openstackclient/volume/v3/volume_group.py +2 -1
- openstackclient/volume/v3/volume_group_snapshot.py +2 -1
- openstackclient/volume/v3/volume_snapshot.py +4 -3
- openstackclient/volume/v3/volume_type.py +10 -21
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.0.0.dist-info}/AUTHORS +3 -0
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.0.0.dist-info}/METADATA +7 -13
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.0.0.dist-info}/RECORD +209 -232
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.0.0.dist-info}/entry_points.txt +0 -41
- python_openstackclient-8.0.0.dist-info/pbr.json +1 -0
- openstackclient/tests/functional/volume/v1/__init__.py +0 -0
- openstackclient/tests/functional/volume/v1/common.py +0 -35
- openstackclient/tests/functional/volume/v1/test_qos.py +0 -100
- openstackclient/tests/functional/volume/v1/test_service.py +0 -76
- openstackclient/tests/functional/volume/v1/test_snapshot.py +0 -232
- openstackclient/tests/functional/volume/v1/test_transfer_request.py +0 -111
- openstackclient/tests/functional/volume/v1/test_volume.py +0 -228
- openstackclient/tests/functional/volume/v1/test_volume_type.py +0 -213
- openstackclient/tests/unit/volume/v1/__init__.py +0 -0
- openstackclient/tests/unit/volume/v1/fakes.py +0 -615
- openstackclient/tests/unit/volume/v1/test_qos_specs.py +0 -471
- openstackclient/tests/unit/volume/v1/test_service.py +0 -295
- openstackclient/tests/unit/volume/v1/test_transfer_request.py +0 -380
- openstackclient/tests/unit/volume/v1/test_type.py +0 -633
- openstackclient/tests/unit/volume/v1/test_volume.py +0 -1447
- openstackclient/tests/unit/volume/v1/test_volume_backup.py +0 -435
- openstackclient/volume/v1/__init__.py +0 -0
- openstackclient/volume/v1/qos_specs.py +0 -377
- openstackclient/volume/v1/service.py +0 -136
- openstackclient/volume/v1/volume.py +0 -734
- openstackclient/volume/v1/volume_backup.py +0 -302
- openstackclient/volume/v1/volume_snapshot.py +0 -433
- openstackclient/volume/v1/volume_transfer_request.py +0 -200
- openstackclient/volume/v1/volume_type.py +0 -520
- python_openstackclient-7.4.0.dist-info/pbr.json +0 -1
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.0.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.0.0.dist-info}/top_level.txt +0 -0
|
@@ -29,7 +29,7 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
29
29
|
def setUp(self):
|
|
30
30
|
super().setUp()
|
|
31
31
|
|
|
32
|
-
self.
|
|
32
|
+
self.compute_client = mock.Mock(_proxy.Proxy)
|
|
33
33
|
|
|
34
34
|
def test_create_security_group(self):
|
|
35
35
|
sg_name = 'name-' + uuid.uuid4().hex
|
|
@@ -43,15 +43,13 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
43
43
|
'rules': [],
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
self.
|
|
47
|
-
data=data
|
|
48
|
-
)
|
|
46
|
+
self.compute_client.post.return_value = fakes.FakeResponse(data=data)
|
|
49
47
|
|
|
50
48
|
result = compute.create_security_group(
|
|
51
|
-
self.
|
|
49
|
+
self.compute_client, sg_name, sg_description
|
|
52
50
|
)
|
|
53
51
|
|
|
54
|
-
self.
|
|
52
|
+
self.compute_client.post.assert_called_once_with(
|
|
55
53
|
'/os-security-groups',
|
|
56
54
|
data={'name': sg_name, 'description': sg_description},
|
|
57
55
|
microversion='2.1',
|
|
@@ -70,13 +68,11 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
70
68
|
}
|
|
71
69
|
],
|
|
72
70
|
}
|
|
73
|
-
self.
|
|
74
|
-
data=data
|
|
75
|
-
)
|
|
71
|
+
self.compute_client.get.return_value = fakes.FakeResponse(data=data)
|
|
76
72
|
|
|
77
|
-
result = compute.list_security_groups(self.
|
|
73
|
+
result = compute.list_security_groups(self.compute_client)
|
|
78
74
|
|
|
79
|
-
self.
|
|
75
|
+
self.compute_client.get.assert_called_once_with(
|
|
80
76
|
'/os-security-groups', microversion='2.1'
|
|
81
77
|
)
|
|
82
78
|
self.assertEqual(data['security_groups'], result)
|
|
@@ -93,13 +89,13 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
93
89
|
'rules': [],
|
|
94
90
|
}
|
|
95
91
|
}
|
|
96
|
-
self.
|
|
92
|
+
self.compute_client.get.side_effect = [
|
|
97
93
|
fakes.FakeResponse(data=data),
|
|
98
94
|
]
|
|
99
95
|
|
|
100
|
-
result = compute.find_security_group(self.
|
|
96
|
+
result = compute.find_security_group(self.compute_client, sg_id)
|
|
101
97
|
|
|
102
|
-
self.
|
|
98
|
+
self.compute_client.get.assert_has_calls(
|
|
103
99
|
[
|
|
104
100
|
mock.call(f'/os-security-groups/{sg_id}', microversion='2.1'),
|
|
105
101
|
]
|
|
@@ -120,14 +116,14 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
120
116
|
}
|
|
121
117
|
],
|
|
122
118
|
}
|
|
123
|
-
self.
|
|
119
|
+
self.compute_client.get.side_effect = [
|
|
124
120
|
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
125
121
|
fakes.FakeResponse(data=data),
|
|
126
122
|
]
|
|
127
123
|
|
|
128
|
-
result = compute.find_security_group(self.
|
|
124
|
+
result = compute.find_security_group(self.compute_client, sg_name)
|
|
129
125
|
|
|
130
|
-
self.
|
|
126
|
+
self.compute_client.get.assert_has_calls(
|
|
131
127
|
[
|
|
132
128
|
mock.call(
|
|
133
129
|
f'/os-security-groups/{sg_name}', microversion='2.1'
|
|
@@ -139,14 +135,14 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
139
135
|
|
|
140
136
|
def test_find_security_group_not_found(self):
|
|
141
137
|
data = {'security_groups': []}
|
|
142
|
-
self.
|
|
138
|
+
self.compute_client.get.side_effect = [
|
|
143
139
|
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
144
140
|
fakes.FakeResponse(data=data),
|
|
145
141
|
]
|
|
146
142
|
self.assertRaises(
|
|
147
143
|
osc_lib_exceptions.NotFound,
|
|
148
144
|
compute.find_security_group,
|
|
149
|
-
self.
|
|
145
|
+
self.compute_client,
|
|
150
146
|
'invalid-sg',
|
|
151
147
|
)
|
|
152
148
|
|
|
@@ -170,7 +166,7 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
170
166
|
},
|
|
171
167
|
],
|
|
172
168
|
}
|
|
173
|
-
self.
|
|
169
|
+
self.compute_client.get.side_effect = [
|
|
174
170
|
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
175
171
|
fakes.FakeResponse(data=data),
|
|
176
172
|
]
|
|
@@ -178,7 +174,7 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
178
174
|
self.assertRaises(
|
|
179
175
|
osc_lib_exceptions.NotFound,
|
|
180
176
|
compute.find_security_group,
|
|
181
|
-
self.
|
|
177
|
+
self.compute_client,
|
|
182
178
|
sg_name,
|
|
183
179
|
)
|
|
184
180
|
|
|
@@ -195,15 +191,13 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
195
191
|
'rules': [],
|
|
196
192
|
}
|
|
197
193
|
}
|
|
198
|
-
self.
|
|
199
|
-
data=data
|
|
200
|
-
)
|
|
194
|
+
self.compute_client.put.return_value = fakes.FakeResponse(data=data)
|
|
201
195
|
|
|
202
196
|
result = compute.update_security_group(
|
|
203
|
-
self.
|
|
197
|
+
self.compute_client, sg_id, sg_name, sg_description
|
|
204
198
|
)
|
|
205
199
|
|
|
206
|
-
self.
|
|
200
|
+
self.compute_client.put.assert_called_once_with(
|
|
207
201
|
f'/os-security-groups/{sg_id}',
|
|
208
202
|
data={'name': sg_name, 'description': sg_description},
|
|
209
203
|
microversion='2.1',
|
|
@@ -212,13 +206,13 @@ class TestSecurityGroup(utils.TestCase):
|
|
|
212
206
|
|
|
213
207
|
def test_delete_security_group(self):
|
|
214
208
|
sg_id = uuid.uuid4().hex
|
|
215
|
-
self.
|
|
209
|
+
self.compute_client.delete.return_value = fakes.FakeResponse(
|
|
216
210
|
status_code=http.HTTPStatus.NO_CONTENT
|
|
217
211
|
)
|
|
218
212
|
|
|
219
|
-
result = compute.delete_security_group(self.
|
|
213
|
+
result = compute.delete_security_group(self.compute_client, sg_id)
|
|
220
214
|
|
|
221
|
-
self.
|
|
215
|
+
self.compute_client.delete.assert_called_once_with(
|
|
222
216
|
f'/os-security-groups/{sg_id}',
|
|
223
217
|
microversion='2.1',
|
|
224
218
|
)
|
|
@@ -229,7 +223,7 @@ class TestSecurityGroupRule(utils.TestCase):
|
|
|
229
223
|
def setUp(self):
|
|
230
224
|
super().setUp()
|
|
231
225
|
|
|
232
|
-
self.
|
|
226
|
+
self.compute_client = mock.Mock(_proxy.Proxy)
|
|
233
227
|
|
|
234
228
|
def test_create_security_group_rule(self):
|
|
235
229
|
sg_id = uuid.uuid4().hex
|
|
@@ -242,12 +236,10 @@ class TestSecurityGroupRule(utils.TestCase):
|
|
|
242
236
|
'cidr': '10.0.0.0/24',
|
|
243
237
|
}
|
|
244
238
|
}
|
|
245
|
-
self.
|
|
246
|
-
data=data
|
|
247
|
-
)
|
|
239
|
+
self.compute_client.post.return_value = fakes.FakeResponse(data=data)
|
|
248
240
|
|
|
249
241
|
result = compute.create_security_group_rule(
|
|
250
|
-
self.
|
|
242
|
+
self.compute_client,
|
|
251
243
|
security_group_id=sg_id,
|
|
252
244
|
ip_protocol='tcp',
|
|
253
245
|
from_port=22,
|
|
@@ -256,7 +248,7 @@ class TestSecurityGroupRule(utils.TestCase):
|
|
|
256
248
|
remote_group=None,
|
|
257
249
|
)
|
|
258
250
|
|
|
259
|
-
self.
|
|
251
|
+
self.compute_client.post.assert_called_once_with(
|
|
260
252
|
'/os-security-group-rules',
|
|
261
253
|
data={
|
|
262
254
|
'parent_group_id': sg_id,
|
|
@@ -272,15 +264,13 @@ class TestSecurityGroupRule(utils.TestCase):
|
|
|
272
264
|
|
|
273
265
|
def test_delete_security_group_rule(self):
|
|
274
266
|
sg_id = uuid.uuid4().hex
|
|
275
|
-
self.
|
|
267
|
+
self.compute_client.delete.return_value = fakes.FakeResponse(
|
|
276
268
|
status_code=http.HTTPStatus.NO_CONTENT
|
|
277
269
|
)
|
|
278
270
|
|
|
279
|
-
result = compute.delete_security_group_rule(
|
|
280
|
-
self.compute_sdk_client, sg_id
|
|
281
|
-
)
|
|
271
|
+
result = compute.delete_security_group_rule(self.compute_client, sg_id)
|
|
282
272
|
|
|
283
|
-
self.
|
|
273
|
+
self.compute_client.delete.assert_called_once_with(
|
|
284
274
|
f'/os-security-group-rules/{sg_id}',
|
|
285
275
|
microversion='2.1',
|
|
286
276
|
)
|
|
@@ -291,7 +281,7 @@ class TestNetwork(utils.TestCase):
|
|
|
291
281
|
def setUp(self):
|
|
292
282
|
super().setUp()
|
|
293
283
|
|
|
294
|
-
self.
|
|
284
|
+
self.compute_client = mock.Mock(_proxy.Proxy)
|
|
295
285
|
|
|
296
286
|
def test_create_network(self):
|
|
297
287
|
net_name = 'name-' + uuid.uuid4().hex
|
|
@@ -305,18 +295,16 @@ class TestNetwork(utils.TestCase):
|
|
|
305
295
|
# other fields omitted for brevity
|
|
306
296
|
}
|
|
307
297
|
}
|
|
308
|
-
self.
|
|
309
|
-
data=data
|
|
310
|
-
)
|
|
298
|
+
self.compute_client.post.return_value = fakes.FakeResponse(data=data)
|
|
311
299
|
|
|
312
300
|
result = compute.create_network(
|
|
313
|
-
self.
|
|
301
|
+
self.compute_client,
|
|
314
302
|
name=net_name,
|
|
315
303
|
subnet=net_subnet,
|
|
316
304
|
share_subnet=True,
|
|
317
305
|
)
|
|
318
306
|
|
|
319
|
-
self.
|
|
307
|
+
self.compute_client.post.assert_called_once_with(
|
|
320
308
|
'/os-networks',
|
|
321
309
|
data={
|
|
322
310
|
'label': net_name,
|
|
@@ -337,13 +325,11 @@ class TestNetwork(utils.TestCase):
|
|
|
337
325
|
}
|
|
338
326
|
],
|
|
339
327
|
}
|
|
340
|
-
self.
|
|
341
|
-
data=data
|
|
342
|
-
)
|
|
328
|
+
self.compute_client.get.return_value = fakes.FakeResponse(data=data)
|
|
343
329
|
|
|
344
|
-
result = compute.list_networks(self.
|
|
330
|
+
result = compute.list_networks(self.compute_client)
|
|
345
331
|
|
|
346
|
-
self.
|
|
332
|
+
self.compute_client.get.assert_called_once_with(
|
|
347
333
|
'/os-networks', microversion='2.1'
|
|
348
334
|
)
|
|
349
335
|
self.assertEqual(data['networks'], result)
|
|
@@ -358,13 +344,13 @@ class TestNetwork(utils.TestCase):
|
|
|
358
344
|
# other fields omitted for brevity
|
|
359
345
|
}
|
|
360
346
|
}
|
|
361
|
-
self.
|
|
347
|
+
self.compute_client.get.side_effect = [
|
|
362
348
|
fakes.FakeResponse(data=data),
|
|
363
349
|
]
|
|
364
350
|
|
|
365
|
-
result = compute.find_network(self.
|
|
351
|
+
result = compute.find_network(self.compute_client, net_id)
|
|
366
352
|
|
|
367
|
-
self.
|
|
353
|
+
self.compute_client.get.assert_has_calls(
|
|
368
354
|
[
|
|
369
355
|
mock.call(f'/os-networks/{net_id}', microversion='2.1'),
|
|
370
356
|
]
|
|
@@ -383,14 +369,14 @@ class TestNetwork(utils.TestCase):
|
|
|
383
369
|
}
|
|
384
370
|
],
|
|
385
371
|
}
|
|
386
|
-
self.
|
|
372
|
+
self.compute_client.get.side_effect = [
|
|
387
373
|
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
388
374
|
fakes.FakeResponse(data=data),
|
|
389
375
|
]
|
|
390
376
|
|
|
391
|
-
result = compute.find_network(self.
|
|
377
|
+
result = compute.find_network(self.compute_client, net_name)
|
|
392
378
|
|
|
393
|
-
self.
|
|
379
|
+
self.compute_client.get.assert_has_calls(
|
|
394
380
|
[
|
|
395
381
|
mock.call(f'/os-networks/{net_name}', microversion='2.1'),
|
|
396
382
|
mock.call('/os-networks', microversion='2.1'),
|
|
@@ -400,14 +386,14 @@ class TestNetwork(utils.TestCase):
|
|
|
400
386
|
|
|
401
387
|
def test_find_network_not_found(self):
|
|
402
388
|
data = {'networks': []}
|
|
403
|
-
self.
|
|
389
|
+
self.compute_client.get.side_effect = [
|
|
404
390
|
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
405
391
|
fakes.FakeResponse(data=data),
|
|
406
392
|
]
|
|
407
393
|
self.assertRaises(
|
|
408
394
|
osc_lib_exceptions.NotFound,
|
|
409
395
|
compute.find_network,
|
|
410
|
-
self.
|
|
396
|
+
self.compute_client,
|
|
411
397
|
'invalid-net',
|
|
412
398
|
)
|
|
413
399
|
|
|
@@ -427,7 +413,7 @@ class TestNetwork(utils.TestCase):
|
|
|
427
413
|
},
|
|
428
414
|
],
|
|
429
415
|
}
|
|
430
|
-
self.
|
|
416
|
+
self.compute_client.get.side_effect = [
|
|
431
417
|
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
|
432
418
|
fakes.FakeResponse(data=data),
|
|
433
419
|
]
|
|
@@ -435,19 +421,19 @@ class TestNetwork(utils.TestCase):
|
|
|
435
421
|
self.assertRaises(
|
|
436
422
|
osc_lib_exceptions.NotFound,
|
|
437
423
|
compute.find_network,
|
|
438
|
-
self.
|
|
424
|
+
self.compute_client,
|
|
439
425
|
net_name,
|
|
440
426
|
)
|
|
441
427
|
|
|
442
428
|
def test_delete_network(self):
|
|
443
429
|
net_id = uuid.uuid4().hex
|
|
444
|
-
self.
|
|
430
|
+
self.compute_client.delete.return_value = fakes.FakeResponse(
|
|
445
431
|
status_code=http.HTTPStatus.NO_CONTENT
|
|
446
432
|
)
|
|
447
433
|
|
|
448
|
-
result = compute.delete_network(self.
|
|
434
|
+
result = compute.delete_network(self.compute_client, net_id)
|
|
449
435
|
|
|
450
|
-
self.
|
|
436
|
+
self.compute_client.delete.assert_called_once_with(
|
|
451
437
|
f'/os-networks/{net_id}', microversion='2.1'
|
|
452
438
|
)
|
|
453
439
|
self.assertIsNone(result)
|
|
@@ -457,7 +443,7 @@ class TestFloatingIP(utils.TestCase):
|
|
|
457
443
|
def setUp(self):
|
|
458
444
|
super().setUp()
|
|
459
445
|
|
|
460
|
-
self.
|
|
446
|
+
self.compute_client = mock.Mock(_proxy.Proxy)
|
|
461
447
|
|
|
462
448
|
def test_create_floating_ip(self):
|
|
463
449
|
network = 'network-' + uuid.uuid4().hex
|
|
@@ -470,15 +456,13 @@ class TestFloatingIP(utils.TestCase):
|
|
|
470
456
|
'pool': network,
|
|
471
457
|
}
|
|
472
458
|
}
|
|
473
|
-
self.
|
|
474
|
-
data=data
|
|
475
|
-
)
|
|
459
|
+
self.compute_client.post.return_value = fakes.FakeResponse(data=data)
|
|
476
460
|
|
|
477
461
|
result = compute.create_floating_ip(
|
|
478
|
-
self.
|
|
462
|
+
self.compute_client, network=network
|
|
479
463
|
)
|
|
480
464
|
|
|
481
|
-
self.
|
|
465
|
+
self.compute_client.post.assert_called_once_with(
|
|
482
466
|
'/os-floating-ips', data={'pool': network}, microversion='2.1'
|
|
483
467
|
)
|
|
484
468
|
self.assertEqual(data['floating_ip'], result)
|
|
@@ -495,13 +479,11 @@ class TestFloatingIP(utils.TestCase):
|
|
|
495
479
|
}
|
|
496
480
|
],
|
|
497
481
|
}
|
|
498
|
-
self.
|
|
499
|
-
data=data
|
|
500
|
-
)
|
|
482
|
+
self.compute_client.get.return_value = fakes.FakeResponse(data=data)
|
|
501
483
|
|
|
502
|
-
result = compute.list_floating_ips(self.
|
|
484
|
+
result = compute.list_floating_ips(self.compute_client)
|
|
503
485
|
|
|
504
|
-
self.
|
|
486
|
+
self.compute_client.get.assert_called_once_with(
|
|
505
487
|
'/os-floating-ips', microversion='2.1'
|
|
506
488
|
)
|
|
507
489
|
self.assertEqual(data['floating_ips'], result)
|
|
@@ -517,26 +499,26 @@ class TestFloatingIP(utils.TestCase):
|
|
|
517
499
|
'pool': f'network-{uuid.uuid4().hex}',
|
|
518
500
|
}
|
|
519
501
|
}
|
|
520
|
-
self.
|
|
502
|
+
self.compute_client.get.side_effect = [
|
|
521
503
|
fakes.FakeResponse(data=data),
|
|
522
504
|
]
|
|
523
505
|
|
|
524
|
-
result = compute.get_floating_ip(self.
|
|
506
|
+
result = compute.get_floating_ip(self.compute_client, fip_id)
|
|
525
507
|
|
|
526
|
-
self.
|
|
508
|
+
self.compute_client.get.assert_called_once_with(
|
|
527
509
|
f'/os-floating-ips/{fip_id}', microversion='2.1'
|
|
528
510
|
)
|
|
529
511
|
self.assertEqual(data['floating_ip'], result)
|
|
530
512
|
|
|
531
513
|
def test_delete_floating_ip(self):
|
|
532
514
|
fip_id = uuid.uuid4().hex
|
|
533
|
-
self.
|
|
515
|
+
self.compute_client.delete.return_value = fakes.FakeResponse(
|
|
534
516
|
status_code=http.HTTPStatus.NO_CONTENT
|
|
535
517
|
)
|
|
536
518
|
|
|
537
|
-
result = compute.delete_floating_ip(self.
|
|
519
|
+
result = compute.delete_floating_ip(self.compute_client, fip_id)
|
|
538
520
|
|
|
539
|
-
self.
|
|
521
|
+
self.compute_client.delete.assert_called_once_with(
|
|
540
522
|
f'/os-floating-ips/{fip_id}', microversion='2.1'
|
|
541
523
|
)
|
|
542
524
|
self.assertIsNone(result)
|
|
@@ -546,7 +528,7 @@ class TestFloatingIPPool(utils.TestCase):
|
|
|
546
528
|
def setUp(self):
|
|
547
529
|
super().setUp()
|
|
548
530
|
|
|
549
|
-
self.
|
|
531
|
+
self.compute_client = mock.Mock(_proxy.Proxy)
|
|
550
532
|
|
|
551
533
|
def test_list_floating_ip_pools(self):
|
|
552
534
|
data = {
|
|
@@ -556,13 +538,11 @@ class TestFloatingIPPool(utils.TestCase):
|
|
|
556
538
|
}
|
|
557
539
|
],
|
|
558
540
|
}
|
|
559
|
-
self.
|
|
560
|
-
data=data
|
|
561
|
-
)
|
|
541
|
+
self.compute_client.get.return_value = fakes.FakeResponse(data=data)
|
|
562
542
|
|
|
563
|
-
result = compute.list_floating_ip_pools(self.
|
|
543
|
+
result = compute.list_floating_ip_pools(self.compute_client)
|
|
564
544
|
|
|
565
|
-
self.
|
|
545
|
+
self.compute_client.get.assert_called_once_with(
|
|
566
546
|
'/os-floating-ip-pools', microversion='2.1'
|
|
567
547
|
)
|
|
568
548
|
self.assertEqual(data['floating_ip_pools'], result)
|
|
@@ -99,9 +99,7 @@ class TestAvailabilityZoneList(
|
|
|
99
99
|
def setUp(self):
|
|
100
100
|
super().setUp()
|
|
101
101
|
|
|
102
|
-
self.
|
|
103
|
-
self.compute_azs
|
|
104
|
-
)
|
|
102
|
+
self.compute_client.availability_zones.return_value = self.compute_azs
|
|
105
103
|
self.volume_sdk_client.availability_zones.return_value = (
|
|
106
104
|
self.volume_azs
|
|
107
105
|
)
|
|
@@ -120,9 +118,7 @@ class TestAvailabilityZoneList(
|
|
|
120
118
|
# containing the data to be listed.
|
|
121
119
|
columns, data = self.cmd.take_action(parsed_args)
|
|
122
120
|
|
|
123
|
-
self.
|
|
124
|
-
details=True
|
|
125
|
-
)
|
|
121
|
+
self.compute_client.availability_zones.assert_called_with(details=True)
|
|
126
122
|
self.volume_sdk_client.availability_zones.assert_called_with()
|
|
127
123
|
self.network_client.availability_zones.assert_called_with()
|
|
128
124
|
|
|
@@ -150,9 +146,7 @@ class TestAvailabilityZoneList(
|
|
|
150
146
|
# containing the data to be listed.
|
|
151
147
|
columns, data = self.cmd.take_action(parsed_args)
|
|
152
148
|
|
|
153
|
-
self.
|
|
154
|
-
details=True
|
|
155
|
-
)
|
|
149
|
+
self.compute_client.availability_zones.assert_called_with(details=True)
|
|
156
150
|
self.volume_sdk_client.availability_zones.assert_called_with()
|
|
157
151
|
self.network_client.availability_zones.assert_called_with()
|
|
158
152
|
|
|
@@ -186,9 +180,7 @@ class TestAvailabilityZoneList(
|
|
|
186
180
|
# containing the data to be listed.
|
|
187
181
|
columns, data = self.cmd.take_action(parsed_args)
|
|
188
182
|
|
|
189
|
-
self.
|
|
190
|
-
details=True
|
|
191
|
-
)
|
|
183
|
+
self.compute_client.availability_zones.assert_called_with(details=True)
|
|
192
184
|
self.volume_sdk_client.availability_zones.assert_not_called()
|
|
193
185
|
self.network_client.availability_zones.assert_not_called()
|
|
194
186
|
|
|
@@ -212,7 +204,7 @@ class TestAvailabilityZoneList(
|
|
|
212
204
|
# containing the data to be listed.
|
|
213
205
|
columns, data = self.cmd.take_action(parsed_args)
|
|
214
206
|
|
|
215
|
-
self.
|
|
207
|
+
self.compute_client.availability_zones.assert_not_called()
|
|
216
208
|
self.volume_sdk_client.availability_zones.assert_called_with()
|
|
217
209
|
self.network_client.availability_zones.assert_not_called()
|
|
218
210
|
|
|
@@ -236,7 +228,7 @@ class TestAvailabilityZoneList(
|
|
|
236
228
|
# containing the data to be listed.
|
|
237
229
|
columns, data = self.cmd.take_action(parsed_args)
|
|
238
230
|
|
|
239
|
-
self.
|
|
231
|
+
self.compute_client.availability_zones.assert_not_called()
|
|
240
232
|
self.volume_sdk_client.availability_zones.assert_not_called()
|
|
241
233
|
self.network_client.availability_zones.assert_called_with()
|
|
242
234
|
|
|
@@ -31,7 +31,7 @@ class TestCommand(test_utils.TestCase):
|
|
|
31
31
|
cmd = FakeCommand(mock.Mock(), mock.Mock())
|
|
32
32
|
self.assertTrue(hasattr(cmd, 'log'))
|
|
33
33
|
self.assertEqual(
|
|
34
|
-
'openstackclient.tests.unit.common.test_command.
|
|
34
|
+
'openstackclient.tests.unit.common.test_command.FakeCommand',
|
|
35
35
|
cmd.log.name,
|
|
36
36
|
)
|
|
37
37
|
|
|
@@ -52,9 +52,7 @@ class TestExtensionList(TestExtension):
|
|
|
52
52
|
self.identity_client.extensions.list.return_value = [
|
|
53
53
|
self.identity_extension
|
|
54
54
|
]
|
|
55
|
-
self.
|
|
56
|
-
self.compute_extension
|
|
57
|
-
]
|
|
55
|
+
self.compute_client.extensions.return_value = [self.compute_extension]
|
|
58
56
|
self.volume_sdk_client.extensions.return_value = [
|
|
59
57
|
self.volume_extension
|
|
60
58
|
]
|
|
@@ -106,7 +104,7 @@ class TestExtensionList(TestExtension):
|
|
|
106
104
|
)
|
|
107
105
|
self._test_extension_list_helper(arglist, verifylist, datalist)
|
|
108
106
|
self.identity_client.extensions.list.assert_called_with()
|
|
109
|
-
self.
|
|
107
|
+
self.compute_client.extensions.assert_called_with()
|
|
110
108
|
self.volume_sdk_client.extensions.assert_called_with()
|
|
111
109
|
self.network_client.extensions.assert_called_with()
|
|
112
110
|
|
|
@@ -153,7 +151,7 @@ class TestExtensionList(TestExtension):
|
|
|
153
151
|
)
|
|
154
152
|
self._test_extension_list_helper(arglist, verifylist, datalist, True)
|
|
155
153
|
self.identity_client.extensions.list.assert_called_with()
|
|
156
|
-
self.
|
|
154
|
+
self.compute_client.extensions.assert_called_with()
|
|
157
155
|
self.volume_sdk_client.extensions.assert_called_with()
|
|
158
156
|
self.network_client.extensions.assert_called_with()
|
|
159
157
|
|
|
@@ -230,7 +228,7 @@ class TestExtensionList(TestExtension):
|
|
|
230
228
|
),
|
|
231
229
|
)
|
|
232
230
|
self._test_extension_list_helper(arglist, verifylist, datalist)
|
|
233
|
-
self.
|
|
231
|
+
self.compute_client.extensions.assert_called_with()
|
|
234
232
|
|
|
235
233
|
def test_extension_list_compute_and_network(self):
|
|
236
234
|
arglist = [
|
|
@@ -254,7 +252,7 @@ class TestExtensionList(TestExtension):
|
|
|
254
252
|
),
|
|
255
253
|
)
|
|
256
254
|
self._test_extension_list_helper(arglist, verifylist, datalist)
|
|
257
|
-
self.
|
|
255
|
+
self.compute_client.extensions.assert_called_with()
|
|
258
256
|
self.network_client.extensions.assert_called_with()
|
|
259
257
|
|
|
260
258
|
def test_extension_list_volume(self):
|
|
@@ -68,7 +68,7 @@ class TestComputeLimits(compute_fakes.TestComputev2):
|
|
|
68
68
|
('DELETE', '*', 100, 100, 'MINUTE', '2011-12-15T22:42:45Z'),
|
|
69
69
|
]
|
|
70
70
|
|
|
71
|
-
self.
|
|
71
|
+
self.compute_client.get_limits.return_value = self.fake_limits
|
|
72
72
|
|
|
73
73
|
def test_compute_show_absolute(self):
|
|
74
74
|
arglist = ['--absolute']
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
12
|
|
|
13
|
-
from io import StringIO
|
|
14
13
|
from unittest import mock
|
|
15
14
|
|
|
16
15
|
from openstackclient.common import project_cleanup
|
|
@@ -70,7 +69,7 @@ class TestProjectCleanup(test_utils.TestCommand):
|
|
|
70
69
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
71
70
|
result = None
|
|
72
71
|
|
|
73
|
-
with mock.patch('
|
|
72
|
+
with mock.patch('getpass.getpass', return_value='y'):
|
|
74
73
|
result = self.cmd.take_action(parsed_args)
|
|
75
74
|
|
|
76
75
|
self.sdk_connect_as_project_mock.assert_called_with(self.project)
|
|
@@ -143,7 +142,7 @@ class TestProjectCleanup(test_utils.TestCommand):
|
|
|
143
142
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
144
143
|
result = None
|
|
145
144
|
|
|
146
|
-
with mock.patch('
|
|
145
|
+
with mock.patch('getpass.getpass', return_value='y'):
|
|
147
146
|
result = self.cmd.take_action(parsed_args)
|
|
148
147
|
|
|
149
148
|
self.sdk_connect_as_project_mock.assert_called_with(self.project)
|
|
@@ -178,7 +177,7 @@ class TestProjectCleanup(test_utils.TestCommand):
|
|
|
178
177
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
179
178
|
result = None
|
|
180
179
|
|
|
181
|
-
with mock.patch('
|
|
180
|
+
with mock.patch('getpass.getpass', return_value='y'):
|
|
182
181
|
result = self.cmd.take_action(parsed_args)
|
|
183
182
|
|
|
184
183
|
self.sdk_connect_as_project_mock.assert_called_with(self.project)
|
|
@@ -234,7 +233,7 @@ class TestProjectCleanup(test_utils.TestCommand):
|
|
|
234
233
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
235
234
|
result = None
|
|
236
235
|
|
|
237
|
-
with mock.patch('
|
|
236
|
+
with mock.patch('getpass.getpass', return_value='y'):
|
|
238
237
|
result = self.cmd.take_action(parsed_args)
|
|
239
238
|
|
|
240
239
|
self.sdk_connect_as_project_mock.assert_not_called()
|
|
@@ -268,7 +267,7 @@ class TestProjectCleanup(test_utils.TestCommand):
|
|
|
268
267
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
269
268
|
result = None
|
|
270
269
|
|
|
271
|
-
with mock.patch('
|
|
270
|
+
with mock.patch('getpass.getpass', return_value='y'):
|
|
272
271
|
result = self.cmd.take_action(parsed_args)
|
|
273
272
|
|
|
274
273
|
self.sdk_connect_as_project_mock.assert_called_with(self.project)
|