python-openstackclient 7.4.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/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 +7 -5
- openstackclient/compute/v2/agent.py +5 -5
- openstackclient/compute/v2/aggregate.py +17 -15
- openstackclient/compute/v2/console.py +10 -4
- openstackclient/compute/v2/console_connection.py +48 -0
- 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 +18 -13
- openstackclient/compute/v2/server.py +144 -121
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_event.py +8 -17
- 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 +95 -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/application_credential.py +2 -2
- openstackclient/identity/v3/consumer.py +4 -3
- openstackclient/identity/v3/credential.py +6 -7
- openstackclient/identity/v3/domain.py +63 -44
- 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 +116 -72
- 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 +23 -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 +47 -11
- openstackclient/image/client.py +7 -5
- openstackclient/image/v1/image.py +11 -15
- openstackclient/image/v2/cache.py +2 -4
- openstackclient/image/v2/image.py +41 -48
- 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 -16
- 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 +69 -47
- 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 +7 -16
- 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 +53 -42
- openstackclient/network/v2/security_group.py +13 -19
- openstackclient/network/v2/security_group_rule.py +10 -11
- 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 +7 -3
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +12 -6
- openstackclient/tests/functional/compute/v2/test_keypair.py +41 -5
- 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 +85 -315
- 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 +34 -17
- openstackclient/tests/unit/compute/v2/test_console_connection.py +72 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +72 -72
- 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 +36 -29
- openstackclient/tests/unit/compute/v2/test_server.py +693 -606
- openstackclient/tests/unit/compute/v2/test_server_backup.py +36 -77
- openstackclient/tests/unit/compute/v2/test_server_event.py +18 -20
- openstackclient/tests/unit/compute/v2/test_server_group.py +25 -31
- openstackclient/tests/unit/compute/v2/test_server_image.py +37 -78
- openstackclient/tests/unit/compute/v2/test_server_migration.py +41 -41
- 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 +48 -26
- openstackclient/tests/unit/identity/v3/test_domain.py +115 -105
- openstackclient/tests/unit/identity/v3/test_endpoint.py +167 -172
- openstackclient/tests/unit/identity/v3/test_group.py +353 -202
- openstackclient/tests/unit/identity/v3/test_mappings.py +2 -2
- openstackclient/tests/unit/identity/v3/test_project.py +16 -0
- openstackclient/tests/unit/identity/v3/test_trust.py +5 -2
- openstackclient/tests/unit/identity/v3/test_user.py +102 -6
- openstackclient/tests/unit/image/v1/fakes.py +2 -2
- openstackclient/tests/unit/image/v1/test_image.py +8 -9
- openstackclient/tests/unit/image/v2/test_image.py +84 -46
- openstackclient/tests/unit/integ/cli/test_shell.py +1 -2
- openstackclient/tests/unit/network/test_common.py +2 -2
- openstackclient/tests/unit/network/v2/fakes.py +405 -485
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +8 -14
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +62 -54
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -1
- 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_compute.py +11 -11
- 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_network_trunk.py +2 -2
- openstackclient/tests/unit/network/v2/test_port.py +21 -22
- openstackclient/tests/unit/network/v2/test_router.py +130 -51
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +11 -19
- openstackclient/tests/unit/network/v2/test_security_group_network.py +25 -27
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +15 -17
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +33 -39
- openstackclient/tests/unit/object/v1/test_object_all.py +4 -3
- openstackclient/tests/unit/test_shell.py +16 -13
- 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 +109 -106
- 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/v2/test_volume_transfer_request.py +1 -1
- openstackclient/tests/unit/volume/v3/fakes.py +2 -8
- 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 +131 -120
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +4 -4
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +198 -203
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +683 -49
- 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/service.py +41 -38
- openstackclient/volume/v2/volume.py +71 -53
- openstackclient/volume/v2/volume_backup.py +15 -10
- openstackclient/volume/v2/volume_snapshot.py +129 -93
- 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_log_level.py +22 -28
- openstackclient/volume/v3/block_storage_manage.py +1 -3
- openstackclient/volume/v3/service.py +105 -14
- openstackclient/volume/v3/volume.py +218 -58
- openstackclient/volume/v3/volume_attachment.py +3 -2
- openstackclient/volume/v3/volume_backup.py +31 -27
- openstackclient/volume/v3/volume_group.py +2 -1
- openstackclient/volume/v3/volume_group_snapshot.py +2 -1
- openstackclient/volume/v3/volume_snapshot.py +489 -13
- openstackclient/volume/v3/volume_type.py +10 -21
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/AUTHORS +11 -0
- python_openstackclient-8.1.0.dist-info/METADATA +264 -0
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/RECORD +238 -259
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/entry_points.txt +7 -47
- python_openstackclient-8.1.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/METADATA +0 -172
- python_openstackclient-7.4.0.dist-info/pbr.json +0 -1
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/top_level.txt +0 -0
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
# under the License.
|
|
14
14
|
#
|
|
15
15
|
|
|
16
|
-
import copy
|
|
17
16
|
import random
|
|
18
17
|
import re
|
|
19
18
|
from unittest import mock
|
|
@@ -32,80 +31,19 @@ from openstack.compute.v2 import server_interface as _server_interface
|
|
|
32
31
|
from openstack.compute.v2 import server_migration as _server_migration
|
|
33
32
|
from openstack.compute.v2 import volume_attachment as _volume_attachment
|
|
34
33
|
|
|
35
|
-
from openstackclient.tests.unit import fakes
|
|
36
|
-
from openstackclient.tests.unit.identity.v2_0 import fakes as identity_fakes
|
|
34
|
+
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
|
|
37
35
|
from openstackclient.tests.unit.image.v2 import fakes as image_fakes
|
|
38
36
|
from openstackclient.tests.unit.network.v2 import fakes as network_fakes
|
|
39
37
|
from openstackclient.tests.unit import utils
|
|
40
38
|
from openstackclient.tests.unit.volume.v3 import fakes as volume_fakes
|
|
41
39
|
|
|
42
40
|
|
|
43
|
-
class FakeComputev2Client:
|
|
44
|
-
def __init__(self, **kwargs):
|
|
45
|
-
self.agents = mock.Mock()
|
|
46
|
-
self.agents.resource_class = fakes.FakeResource(None, {})
|
|
47
|
-
|
|
48
|
-
self.images = mock.Mock()
|
|
49
|
-
self.images.resource_class = fakes.FakeResource(None, {})
|
|
50
|
-
|
|
51
|
-
self.servers = mock.Mock()
|
|
52
|
-
self.servers.resource_class = fakes.FakeResource(None, {})
|
|
53
|
-
|
|
54
|
-
self.services = mock.Mock()
|
|
55
|
-
self.services.resource_class = fakes.FakeResource(None, {})
|
|
56
|
-
|
|
57
|
-
self.extensions = mock.Mock()
|
|
58
|
-
self.extensions.resource_class = fakes.FakeResource(None, {})
|
|
59
|
-
|
|
60
|
-
self.flavors = mock.Mock()
|
|
61
|
-
|
|
62
|
-
self.flavor_access = mock.Mock()
|
|
63
|
-
self.flavor_access.resource_class = fakes.FakeResource(None, {})
|
|
64
|
-
|
|
65
|
-
self.usage = mock.Mock()
|
|
66
|
-
self.usage.resource_class = fakes.FakeResource(None, {})
|
|
67
|
-
|
|
68
|
-
self.volumes = mock.Mock()
|
|
69
|
-
self.volumes.resource_class = fakes.FakeResource(None, {})
|
|
70
|
-
|
|
71
|
-
self.hypervisors = mock.Mock()
|
|
72
|
-
self.hypervisors.resource_class = fakes.FakeResource(None, {})
|
|
73
|
-
|
|
74
|
-
self.hypervisors_stats = mock.Mock()
|
|
75
|
-
self.hypervisors_stats.resource_class = fakes.FakeResource(None, {})
|
|
76
|
-
|
|
77
|
-
self.keypairs = mock.Mock()
|
|
78
|
-
self.keypairs.resource_class = fakes.FakeResource(None, {})
|
|
79
|
-
|
|
80
|
-
self.server_groups = mock.Mock()
|
|
81
|
-
self.server_groups.resource_class = fakes.FakeResource(None, {})
|
|
82
|
-
|
|
83
|
-
self.server_migrations = mock.Mock()
|
|
84
|
-
self.server_migrations.resource_class = fakes.FakeResource(None, {})
|
|
85
|
-
|
|
86
|
-
self.instance_action = mock.Mock()
|
|
87
|
-
self.instance_action.resource_class = fakes.FakeResource(None, {})
|
|
88
|
-
|
|
89
|
-
self.migrations = mock.Mock()
|
|
90
|
-
self.migrations.resource_class = fakes.FakeResource(None, {})
|
|
91
|
-
|
|
92
|
-
self.auth_token = kwargs['token']
|
|
93
|
-
|
|
94
|
-
self.management_url = kwargs['endpoint']
|
|
95
|
-
|
|
96
|
-
|
|
97
41
|
class FakeClientMixin:
|
|
98
42
|
def setUp(self):
|
|
99
43
|
super().setUp()
|
|
100
44
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
self.app.client_manager.sdk_connection.compute = mock.Mock(
|
|
104
|
-
_proxy.Proxy
|
|
105
|
-
)
|
|
106
|
-
self.compute_sdk_client = (
|
|
107
|
-
self.app.client_manager.sdk_connection.compute
|
|
108
|
-
)
|
|
45
|
+
self.app.client_manager.compute = mock.Mock(_proxy.Proxy)
|
|
46
|
+
self.compute_client = self.app.client_manager.compute
|
|
109
47
|
self.set_compute_api_version() # default to the lowest
|
|
110
48
|
|
|
111
49
|
def set_compute_api_version(self, version: str = '2.1'):
|
|
@@ -117,8 +55,8 @@ class FakeClientMixin:
|
|
|
117
55
|
"""
|
|
118
56
|
assert re.match(r'2.\d+', version)
|
|
119
57
|
|
|
120
|
-
self.
|
|
121
|
-
self.
|
|
58
|
+
self.compute_client.default_microversion = version
|
|
59
|
+
self.compute_client.get_endpoint_data.return_value = (
|
|
122
60
|
discover.EndpointData(
|
|
123
61
|
min_microversion='2.1', # nova has not bumped this yet
|
|
124
62
|
max_microversion=version,
|
|
@@ -127,10 +65,10 @@ class FakeClientMixin:
|
|
|
127
65
|
|
|
128
66
|
|
|
129
67
|
class TestComputev2(
|
|
68
|
+
identity_fakes.FakeClientMixin,
|
|
130
69
|
network_fakes.FakeClientMixin,
|
|
131
70
|
image_fakes.FakeClientMixin,
|
|
132
71
|
volume_fakes.FakeClientMixin,
|
|
133
|
-
identity_fakes.FakeClientMixin,
|
|
134
72
|
FakeClientMixin,
|
|
135
73
|
utils.TestCommand,
|
|
136
74
|
): ...
|
|
@@ -139,16 +77,14 @@ class TestComputev2(
|
|
|
139
77
|
def create_one_agent(attrs=None):
|
|
140
78
|
"""Create a fake agent.
|
|
141
79
|
|
|
142
|
-
:param dict attrs:
|
|
143
|
-
|
|
144
|
-
:return:
|
|
145
|
-
A FakeResource object, with agent_id, os, and so on
|
|
80
|
+
:param dict attrs: A dictionary with all attributes
|
|
81
|
+
:return: A dicionarty faking the agent
|
|
146
82
|
"""
|
|
147
83
|
|
|
148
84
|
attrs = attrs or {}
|
|
149
85
|
|
|
150
86
|
# set default attributes.
|
|
151
|
-
|
|
87
|
+
agent_attrs = {
|
|
152
88
|
'agent_id': 'agent-id-' + uuid.uuid4().hex,
|
|
153
89
|
'os': 'agent-os-' + uuid.uuid4().hex,
|
|
154
90
|
'architecture': 'agent-architecture',
|
|
@@ -158,22 +94,20 @@ def create_one_agent(attrs=None):
|
|
|
158
94
|
'hypervisor': 'hypervisor',
|
|
159
95
|
}
|
|
160
96
|
|
|
97
|
+
assert not set(attrs) - set(agent_attrs), 'unknown keys'
|
|
98
|
+
|
|
161
99
|
# Overwrite default attributes.
|
|
162
|
-
|
|
100
|
+
agent_attrs.update(attrs)
|
|
163
101
|
|
|
164
|
-
|
|
165
|
-
return agent
|
|
102
|
+
return agent_attrs
|
|
166
103
|
|
|
167
104
|
|
|
168
105
|
def create_agents(attrs=None, count=2):
|
|
169
106
|
"""Create multiple fake agents.
|
|
170
107
|
|
|
171
|
-
:param dict attrs:
|
|
172
|
-
|
|
173
|
-
:
|
|
174
|
-
The number of agents to fake
|
|
175
|
-
:return:
|
|
176
|
-
A list of FakeResource objects faking the agents
|
|
108
|
+
:param dict attrs: A dictionary with all attributes
|
|
109
|
+
:param int count: The number of agents to fake
|
|
110
|
+
:return: A list of dictionaries faking the agents
|
|
177
111
|
"""
|
|
178
112
|
agents = []
|
|
179
113
|
for i in range(0, count):
|
|
@@ -186,7 +120,7 @@ def create_one_extension(attrs=None):
|
|
|
186
120
|
"""Create a fake extension.
|
|
187
121
|
|
|
188
122
|
:param dict attrs: A dictionary with all attributes
|
|
189
|
-
:return: A fake openstack.compute.v2.extension.Extension object
|
|
123
|
+
:return: A fake :class:`~openstack.compute.v2.extension.Extension` object
|
|
190
124
|
"""
|
|
191
125
|
attrs = attrs or {}
|
|
192
126
|
|
|
@@ -218,10 +152,8 @@ def create_one_extension(attrs=None):
|
|
|
218
152
|
def create_one_security_group(attrs=None):
|
|
219
153
|
"""Create a fake security group.
|
|
220
154
|
|
|
221
|
-
:param dict attrs:
|
|
222
|
-
|
|
223
|
-
:return:
|
|
224
|
-
A FakeResource object, with id, name, etc.
|
|
155
|
+
:param dict attrs: A dictionary with all attributes
|
|
156
|
+
:return: A dictionary faking the security group
|
|
225
157
|
"""
|
|
226
158
|
attrs = attrs or {}
|
|
227
159
|
|
|
@@ -234,6 +166,8 @@ def create_one_security_group(attrs=None):
|
|
|
234
166
|
'rules': [],
|
|
235
167
|
}
|
|
236
168
|
|
|
169
|
+
assert not set(attrs) - set(security_group_attrs), 'unknown keys'
|
|
170
|
+
|
|
237
171
|
# Overwrite default attributes.
|
|
238
172
|
security_group_attrs.update(attrs)
|
|
239
173
|
return security_group_attrs
|
|
@@ -242,12 +176,9 @@ def create_one_security_group(attrs=None):
|
|
|
242
176
|
def create_security_groups(attrs=None, count=2):
|
|
243
177
|
"""Create multiple fake security groups.
|
|
244
178
|
|
|
245
|
-
:param dict attrs:
|
|
246
|
-
|
|
247
|
-
:
|
|
248
|
-
The number of security groups to fake
|
|
249
|
-
:return:
|
|
250
|
-
A list of FakeResource objects faking the security groups
|
|
179
|
+
:param dict attrs: A dictionary with all attributes
|
|
180
|
+
:param int count: The number of security groups to fake
|
|
181
|
+
:return: A list of dictionaries faking the security groups
|
|
251
182
|
"""
|
|
252
183
|
security_groups = []
|
|
253
184
|
for i in range(0, count):
|
|
@@ -256,32 +187,11 @@ def create_security_groups(attrs=None, count=2):
|
|
|
256
187
|
return security_groups
|
|
257
188
|
|
|
258
189
|
|
|
259
|
-
def get_security_groups(security_groups=None, count=2):
|
|
260
|
-
"""Get an iterable MagicMock with a list of faked security groups.
|
|
261
|
-
|
|
262
|
-
If security groups list is provided, then initialize the Mock object
|
|
263
|
-
with the list. Otherwise create one.
|
|
264
|
-
|
|
265
|
-
:param List security_groups:
|
|
266
|
-
A list of FakeResource objects faking security groups
|
|
267
|
-
:param int count:
|
|
268
|
-
The number of security groups to fake
|
|
269
|
-
:return:
|
|
270
|
-
An iterable Mock object with side_effect set to a list of faked
|
|
271
|
-
security groups
|
|
272
|
-
"""
|
|
273
|
-
if security_groups is None:
|
|
274
|
-
security_groups = create_security_groups(count)
|
|
275
|
-
return mock.Mock(side_effect=security_groups)
|
|
276
|
-
|
|
277
|
-
|
|
278
190
|
def create_one_security_group_rule(attrs=None):
|
|
279
191
|
"""Create a fake security group rule.
|
|
280
192
|
|
|
281
|
-
:param dict attrs:
|
|
282
|
-
|
|
283
|
-
:return:
|
|
284
|
-
A FakeResource object, with id, etc.
|
|
193
|
+
:param dict attrs: A dictionary with all attributes
|
|
194
|
+
:return: A dictionary faking the security group rule
|
|
285
195
|
"""
|
|
286
196
|
attrs = attrs or {}
|
|
287
197
|
|
|
@@ -296,6 +206,8 @@ def create_one_security_group_rule(attrs=None):
|
|
|
296
206
|
'to_port': 0,
|
|
297
207
|
}
|
|
298
208
|
|
|
209
|
+
assert not set(attrs) - set(security_group_rule_attrs), 'unknown keys'
|
|
210
|
+
|
|
299
211
|
# Overwrite default attributes.
|
|
300
212
|
security_group_rule_attrs.update(attrs)
|
|
301
213
|
|
|
@@ -305,12 +217,9 @@ def create_one_security_group_rule(attrs=None):
|
|
|
305
217
|
def create_security_group_rules(attrs=None, count=2):
|
|
306
218
|
"""Create multiple fake security group rules.
|
|
307
219
|
|
|
308
|
-
:param dict attrs:
|
|
309
|
-
|
|
310
|
-
:
|
|
311
|
-
The number of security group rules to fake
|
|
312
|
-
:return:
|
|
313
|
-
A list of FakeResource objects faking the security group rules
|
|
220
|
+
:param dict attrs: A dictionary with all attributes
|
|
221
|
+
:param int count: The number of security group rules to fake
|
|
222
|
+
:return: A list of dictionaries faking the security group rules
|
|
314
223
|
"""
|
|
315
224
|
security_group_rules = []
|
|
316
225
|
for i in range(0, count):
|
|
@@ -319,66 +228,11 @@ def create_security_group_rules(attrs=None, count=2):
|
|
|
319
228
|
return security_group_rules
|
|
320
229
|
|
|
321
230
|
|
|
322
|
-
def create_one_server(attrs=None
|
|
323
|
-
"""Create a fake server
|
|
324
|
-
|
|
325
|
-
:param dict attrs:
|
|
326
|
-
A dictionary with all attributes
|
|
327
|
-
:param dict methods:
|
|
328
|
-
A dictionary with all methods
|
|
329
|
-
:return:
|
|
330
|
-
A FakeResource object, with id, name, metadata, and so on
|
|
331
|
-
"""
|
|
332
|
-
attrs = attrs or {}
|
|
333
|
-
methods = methods or {}
|
|
334
|
-
|
|
335
|
-
# Set default attributes.
|
|
336
|
-
server_info = {
|
|
337
|
-
'id': 'server-id-' + uuid.uuid4().hex,
|
|
338
|
-
'name': 'server-name-' + uuid.uuid4().hex,
|
|
339
|
-
'metadata': {},
|
|
340
|
-
'image': {
|
|
341
|
-
'id': 'image-id-' + uuid.uuid4().hex,
|
|
342
|
-
},
|
|
343
|
-
'flavor': {
|
|
344
|
-
'id': 'flavor-id-' + uuid.uuid4().hex,
|
|
345
|
-
},
|
|
346
|
-
'OS-EXT-STS:power_state': 1,
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
# Overwrite default attributes.
|
|
350
|
-
server_info.update(attrs)
|
|
351
|
-
|
|
352
|
-
server = fakes.FakeResource(
|
|
353
|
-
info=copy.deepcopy(server_info), methods=methods, loaded=True
|
|
354
|
-
)
|
|
355
|
-
return server
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
def create_servers(attrs=None, methods=None, count=2):
|
|
359
|
-
"""Create multiple fake servers.
|
|
360
|
-
|
|
361
|
-
:param dict attrs:
|
|
362
|
-
A dictionary with all attributes
|
|
363
|
-
:param dict methods:
|
|
364
|
-
A dictionary with all methods
|
|
365
|
-
:param int count:
|
|
366
|
-
The number of servers to fake
|
|
367
|
-
:return:
|
|
368
|
-
A list of FakeResource objects faking the servers
|
|
369
|
-
"""
|
|
370
|
-
servers = []
|
|
371
|
-
for i in range(0, count):
|
|
372
|
-
servers.append(create_one_server(attrs, methods))
|
|
373
|
-
|
|
374
|
-
return servers
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
def create_one_sdk_server(attrs=None):
|
|
378
|
-
"""Create a fake server for testing migration to sdk
|
|
231
|
+
def create_one_server(attrs=None):
|
|
232
|
+
"""Create a fake server
|
|
379
233
|
|
|
380
234
|
:param dict attrs: A dictionary with all attributes
|
|
381
|
-
:return: A fake openstack.compute.v2.server.Server object,
|
|
235
|
+
:return: A fake :class:`~openstack.compute.v2.server.Server` object,
|
|
382
236
|
"""
|
|
383
237
|
attrs = attrs or {}
|
|
384
238
|
|
|
@@ -406,43 +260,26 @@ def create_one_sdk_server(attrs=None):
|
|
|
406
260
|
return server
|
|
407
261
|
|
|
408
262
|
|
|
409
|
-
def
|
|
410
|
-
"""Create multiple fake servers
|
|
263
|
+
def create_servers(attrs=None, count=2):
|
|
264
|
+
"""Create multiple fake servers
|
|
411
265
|
|
|
412
266
|
:param dict attrs: A dictionary with all attributes
|
|
413
267
|
:param int count: The number of servers to fake
|
|
414
|
-
:return: A list of fake openstack.compute.v2.server.Server objects
|
|
268
|
+
:return: A list of fake :class:`openstack.compute.v2.server.Server` objects
|
|
415
269
|
"""
|
|
416
270
|
servers = []
|
|
417
271
|
for i in range(0, count):
|
|
418
|
-
servers.append(
|
|
272
|
+
servers.append(create_one_server(attrs))
|
|
419
273
|
|
|
420
274
|
return servers
|
|
421
275
|
|
|
422
276
|
|
|
423
|
-
def get_servers(servers=None, count=2):
|
|
424
|
-
"""Get an iterable MagicMock object with a list of faked servers.
|
|
425
|
-
|
|
426
|
-
If servers list is provided, then initialize the Mock object with the
|
|
427
|
-
list. Otherwise create one.
|
|
428
|
-
|
|
429
|
-
:param list servers: A list of fake openstack.compute.v2.server.Server
|
|
430
|
-
objects
|
|
431
|
-
:param int count:
|
|
432
|
-
The number of servers to fake
|
|
433
|
-
:return: An iterable Mock object with side_effect set to a list of faked
|
|
434
|
-
servers
|
|
435
|
-
"""
|
|
436
|
-
if servers is None:
|
|
437
|
-
servers = create_servers(count)
|
|
438
|
-
return mock.Mock(side_effect=servers)
|
|
439
|
-
|
|
440
|
-
|
|
441
277
|
def create_one_server_action(attrs=None):
|
|
442
278
|
"""Create a fake server action.
|
|
443
279
|
|
|
444
280
|
:param attrs: A dictionary with all attributes
|
|
445
|
-
:return: A fake openstack.compute.v2.server_action.ServerAction
|
|
281
|
+
:return: A fake :class:`~openstack.compute.v2.server_action.ServerAction`
|
|
282
|
+
object
|
|
446
283
|
"""
|
|
447
284
|
attrs = attrs or {}
|
|
448
285
|
|
|
@@ -485,7 +322,7 @@ def create_one_flavor(attrs=None):
|
|
|
485
322
|
"""Create a fake flavor.
|
|
486
323
|
|
|
487
324
|
:param dict attrs: A dictionary with all attributes
|
|
488
|
-
:return: A fake openstack.compute.v2.flavor.Flavor object
|
|
325
|
+
:return: A fake :class:`~openstack.compute.v2.flavor.Flavor` object
|
|
489
326
|
"""
|
|
490
327
|
attrs = attrs or {}
|
|
491
328
|
|
|
@@ -518,7 +355,7 @@ def create_flavors(attrs=None, count=2):
|
|
|
518
355
|
|
|
519
356
|
:param dict attrs: A dictionary with all attributes
|
|
520
357
|
:param int count: The number of flavors to fake
|
|
521
|
-
:return: A list of fake openstack.compute.v2.flavor.Flavor objects
|
|
358
|
+
:return: A list of fake :class:`openstack.compute.v2.flavor.Flavor` objects
|
|
522
359
|
"""
|
|
523
360
|
flavors = []
|
|
524
361
|
for i in range(0, count):
|
|
@@ -527,30 +364,11 @@ def create_flavors(attrs=None, count=2):
|
|
|
527
364
|
return flavors
|
|
528
365
|
|
|
529
366
|
|
|
530
|
-
def get_flavors(flavors=None, count=2):
|
|
531
|
-
"""Get an iterable MagicMock object with a list of faked flavors.
|
|
532
|
-
|
|
533
|
-
If flavors list is provided, then initialize the Mock object with the
|
|
534
|
-
list. Otherwise create one.
|
|
535
|
-
|
|
536
|
-
:param list flavors: A list of fake openstack.compute.v2.flavor.Flavor
|
|
537
|
-
objects
|
|
538
|
-
:param int count: The number of flavors to fake
|
|
539
|
-
:return: An iterable Mock object with side_effect set to a list of faked
|
|
540
|
-
flavors
|
|
541
|
-
"""
|
|
542
|
-
if flavors is None:
|
|
543
|
-
flavors = create_flavors(count)
|
|
544
|
-
return mock.Mock(side_effect=flavors)
|
|
545
|
-
|
|
546
|
-
|
|
547
367
|
def create_one_flavor_access(attrs=None):
|
|
548
368
|
"""Create a fake flavor access.
|
|
549
369
|
|
|
550
|
-
:param dict attrs:
|
|
551
|
-
|
|
552
|
-
:return:
|
|
553
|
-
A FakeResource object, with flavor_id, tenat_id
|
|
370
|
+
:param dict attrs: A dictionary with all attributes
|
|
371
|
+
:return: A dictionary faking the flavor access
|
|
554
372
|
"""
|
|
555
373
|
attrs = attrs or {}
|
|
556
374
|
|
|
@@ -560,22 +378,20 @@ def create_one_flavor_access(attrs=None):
|
|
|
560
378
|
'tenant_id': 'tenant-id-' + uuid.uuid4().hex,
|
|
561
379
|
}
|
|
562
380
|
|
|
381
|
+
assert not set(attrs) - set(flavor_access_info), 'unknown keys'
|
|
382
|
+
|
|
563
383
|
# Overwrite default attributes.
|
|
564
384
|
flavor_access_info.update(attrs)
|
|
565
385
|
|
|
566
|
-
|
|
567
|
-
info=copy.deepcopy(flavor_access_info), loaded=True
|
|
568
|
-
)
|
|
569
|
-
|
|
570
|
-
return flavor_access
|
|
386
|
+
return flavor_access_info
|
|
571
387
|
|
|
572
388
|
|
|
573
389
|
def create_one_availability_zone(attrs=None):
|
|
574
390
|
"""Create a fake AZ.
|
|
575
391
|
|
|
576
392
|
:param dict attrs: A dictionary with all attributes
|
|
577
|
-
:return: A fake
|
|
578
|
-
object
|
|
393
|
+
:return: A fake
|
|
394
|
+
:class:`~openstack.compute.v2.availability_zone.AvailabilityZone` object
|
|
579
395
|
"""
|
|
580
396
|
attrs = attrs or {}
|
|
581
397
|
|
|
@@ -622,12 +438,10 @@ def create_availability_zones(attrs=None, count=2):
|
|
|
622
438
|
|
|
623
439
|
|
|
624
440
|
def create_one_floating_ip(attrs=None):
|
|
625
|
-
"""Create a fake floating
|
|
441
|
+
"""Create a fake floating IP.
|
|
626
442
|
|
|
627
|
-
:param dict attrs:
|
|
628
|
-
|
|
629
|
-
:return:
|
|
630
|
-
A FakeResource object, with id, ip, and so on
|
|
443
|
+
:param dict attrs: A dictionary with all attributes
|
|
444
|
+
:return: A dictionary faking the floating IP
|
|
631
445
|
"""
|
|
632
446
|
attrs = attrs or {}
|
|
633
447
|
|
|
@@ -640,6 +454,8 @@ def create_one_floating_ip(attrs=None):
|
|
|
640
454
|
'pool': 'public',
|
|
641
455
|
}
|
|
642
456
|
|
|
457
|
+
assert not set(attrs) - set(floating_ip_attrs), 'unknown keys'
|
|
458
|
+
|
|
643
459
|
# Overwrite default attributes.
|
|
644
460
|
floating_ip_attrs.update(attrs)
|
|
645
461
|
|
|
@@ -647,14 +463,11 @@ def create_one_floating_ip(attrs=None):
|
|
|
647
463
|
|
|
648
464
|
|
|
649
465
|
def create_floating_ips(attrs=None, count=2):
|
|
650
|
-
"""Create multiple fake floating
|
|
651
|
-
|
|
652
|
-
:param dict attrs:
|
|
653
|
-
|
|
654
|
-
:
|
|
655
|
-
The number of floating ips to fake
|
|
656
|
-
:return:
|
|
657
|
-
A list of FakeResource objects faking the floating ips
|
|
466
|
+
"""Create multiple fake floating IPs.
|
|
467
|
+
|
|
468
|
+
:param dict attrs: A dictionary with all attributes
|
|
469
|
+
:param int count: The number of floating IPs to fake
|
|
470
|
+
:return: A list of dictionaries faking the floating IPs
|
|
658
471
|
"""
|
|
659
472
|
floating_ips = []
|
|
660
473
|
for i in range(0, count):
|
|
@@ -662,32 +475,11 @@ def create_floating_ips(attrs=None, count=2):
|
|
|
662
475
|
return floating_ips
|
|
663
476
|
|
|
664
477
|
|
|
665
|
-
def get_floating_ips(floating_ips=None, count=2):
|
|
666
|
-
"""Get an iterable MagicMock object with a list of faked floating ips.
|
|
667
|
-
|
|
668
|
-
If floating_ips list is provided, then initialize the Mock object
|
|
669
|
-
with the list. Otherwise create one.
|
|
670
|
-
|
|
671
|
-
:param List floating_ips:
|
|
672
|
-
A list of FakeResource objects faking floating ips
|
|
673
|
-
:param int count:
|
|
674
|
-
The number of floating ips to fake
|
|
675
|
-
:return:
|
|
676
|
-
An iterable Mock object with side_effect set to a list of faked
|
|
677
|
-
floating ips
|
|
678
|
-
"""
|
|
679
|
-
if floating_ips is None:
|
|
680
|
-
floating_ips = create_floating_ips(count)
|
|
681
|
-
return mock.Mock(side_effect=floating_ips)
|
|
682
|
-
|
|
683
|
-
|
|
684
478
|
def create_one_floating_ip_pool(attrs=None):
|
|
685
|
-
"""Create a fake floating
|
|
479
|
+
"""Create a fake floating IP pool.
|
|
686
480
|
|
|
687
|
-
:param dict attrs:
|
|
688
|
-
|
|
689
|
-
:return:
|
|
690
|
-
A FakeResource object, with name, etc
|
|
481
|
+
:param dict attrs: A dictionary with all attributes
|
|
482
|
+
:return: A dictionary faking the floating IP pool
|
|
691
483
|
"""
|
|
692
484
|
if attrs is None:
|
|
693
485
|
attrs = {}
|
|
@@ -697,6 +489,8 @@ def create_one_floating_ip_pool(attrs=None):
|
|
|
697
489
|
'name': 'floating-ip-pool-name-' + uuid.uuid4().hex,
|
|
698
490
|
}
|
|
699
491
|
|
|
492
|
+
assert not set(attrs) - set(floating_ip_pool_attrs), 'unknown keys'
|
|
493
|
+
|
|
700
494
|
# Overwrite default attributes.
|
|
701
495
|
floating_ip_pool_attrs.update(attrs)
|
|
702
496
|
|
|
@@ -704,14 +498,11 @@ def create_one_floating_ip_pool(attrs=None):
|
|
|
704
498
|
|
|
705
499
|
|
|
706
500
|
def create_floating_ip_pools(attrs=None, count=2):
|
|
707
|
-
"""Create multiple fake floating
|
|
708
|
-
|
|
709
|
-
:param dict attrs:
|
|
710
|
-
|
|
711
|
-
:
|
|
712
|
-
The number of floating ip pools to fake
|
|
713
|
-
:return:
|
|
714
|
-
A list of FakeResource objects faking the floating ip pools
|
|
501
|
+
"""Create multiple fake floating IP pools.
|
|
502
|
+
|
|
503
|
+
:param dict attrs: A dictionary with all attributes
|
|
504
|
+
:param int count: The number of floating IP pools to fake
|
|
505
|
+
:return: A list of dictionaries faking the floating IP pools
|
|
715
506
|
"""
|
|
716
507
|
floating_ip_pools = []
|
|
717
508
|
for i in range(0, count):
|
|
@@ -722,10 +513,8 @@ def create_floating_ip_pools(attrs=None, count=2):
|
|
|
722
513
|
def create_one_network(attrs=None):
|
|
723
514
|
"""Create a fake network.
|
|
724
515
|
|
|
725
|
-
:param dict attrs:
|
|
726
|
-
|
|
727
|
-
:return:
|
|
728
|
-
A FakeResource object, with id, label, cidr and so on
|
|
516
|
+
:param dict attrs: A dictionary with all attributes
|
|
517
|
+
:return: A dictionary faking the network
|
|
729
518
|
"""
|
|
730
519
|
attrs = attrs or {}
|
|
731
520
|
|
|
@@ -765,6 +554,8 @@ def create_one_network(attrs=None):
|
|
|
765
554
|
'vpn_public_port': None,
|
|
766
555
|
}
|
|
767
556
|
|
|
557
|
+
assert not set(attrs) - set(network_attrs), 'unknown keys'
|
|
558
|
+
|
|
768
559
|
# Overwrite default attributes.
|
|
769
560
|
network_attrs.update(attrs)
|
|
770
561
|
|
|
@@ -774,12 +565,9 @@ def create_one_network(attrs=None):
|
|
|
774
565
|
def create_networks(attrs=None, count=2):
|
|
775
566
|
"""Create multiple fake networks.
|
|
776
567
|
|
|
777
|
-
:param dict attrs:
|
|
778
|
-
|
|
779
|
-
:
|
|
780
|
-
The number of networks to fake
|
|
781
|
-
:return:
|
|
782
|
-
A list of FakeResource objects faking the networks
|
|
568
|
+
:param dict attrs: A dictionary with all attributes
|
|
569
|
+
:param int count: The number of networks to fake
|
|
570
|
+
:return: A list of dictionaries faking the networks
|
|
783
571
|
"""
|
|
784
572
|
networks = []
|
|
785
573
|
for i in range(0, count):
|
|
@@ -788,25 +576,6 @@ def create_networks(attrs=None, count=2):
|
|
|
788
576
|
return networks
|
|
789
577
|
|
|
790
578
|
|
|
791
|
-
def get_networks(networks=None, count=2):
|
|
792
|
-
"""Get an iterable MagicMock object with a list of faked networks.
|
|
793
|
-
|
|
794
|
-
If networks list is provided, then initialize the Mock object with the
|
|
795
|
-
list. Otherwise create one.
|
|
796
|
-
|
|
797
|
-
:param List networks:
|
|
798
|
-
A list of FakeResource objects faking networks
|
|
799
|
-
:param int count:
|
|
800
|
-
The number of networks to fake
|
|
801
|
-
:return:
|
|
802
|
-
An iterable Mock object with side_effect set to a list of faked
|
|
803
|
-
networks
|
|
804
|
-
"""
|
|
805
|
-
if networks is None:
|
|
806
|
-
networks = create_networks(count=count)
|
|
807
|
-
return mock.Mock(side_effect=networks)
|
|
808
|
-
|
|
809
|
-
|
|
810
579
|
def create_limits(attrs=None):
|
|
811
580
|
"""Create a fake limits object."""
|
|
812
581
|
attrs = attrs or {}
|
|
@@ -872,7 +641,7 @@ def create_one_migration(attrs=None):
|
|
|
872
641
|
"""Create a fake migration.
|
|
873
642
|
|
|
874
643
|
:param dict attrs: A dictionary with all attributes
|
|
875
|
-
:return: A fake openstack.compute.v2.migration.Migration object
|
|
644
|
+
:return: A fake :class:`~openstack.compute.v2.migration.Migration` object
|
|
876
645
|
"""
|
|
877
646
|
attrs = attrs or {}
|
|
878
647
|
|
|
@@ -908,7 +677,7 @@ def create_migrations(attrs=None, count=2):
|
|
|
908
677
|
|
|
909
678
|
:param dict attrs: A dictionary with all attributes
|
|
910
679
|
:param int count: The number of migrations to fake
|
|
911
|
-
:return: A list of fake openstack.compute.v2.migration.Migration objects
|
|
680
|
+
:return: A list of fake :class:`openstack.compute.v2.migration.Migration` objects
|
|
912
681
|
"""
|
|
913
682
|
migrations = []
|
|
914
683
|
for i in range(0, count):
|
|
@@ -921,7 +690,8 @@ def create_one_server_migration(attrs=None):
|
|
|
921
690
|
"""Create a fake server migration.
|
|
922
691
|
|
|
923
692
|
:param dict attrs: A dictionary with all attributes
|
|
924
|
-
:return A fake
|
|
693
|
+
:return: A fake
|
|
694
|
+
:class:`~openstack.compute.v2.server_migration.ServerMigration` object
|
|
925
695
|
"""
|
|
926
696
|
attrs = attrs or {}
|
|
927
697
|
|
|
@@ -977,8 +747,8 @@ def create_one_volume_attachment(attrs=None):
|
|
|
977
747
|
"""Create a fake volume attachment.
|
|
978
748
|
|
|
979
749
|
:param dict attrs: A dictionary with all attributes
|
|
980
|
-
:return: A fake
|
|
981
|
-
object
|
|
750
|
+
:return: A fake
|
|
751
|
+
:class:`~openstack.compute.v2.volume_attachment.VolumeAttachment` object
|
|
982
752
|
"""
|
|
983
753
|
attrs = attrs or {}
|
|
984
754
|
|
|
@@ -1019,12 +789,12 @@ def create_volume_attachments(attrs=None, count=2):
|
|
|
1019
789
|
|
|
1020
790
|
|
|
1021
791
|
def create_one_server_interface(attrs=None):
|
|
1022
|
-
"""Create a fake
|
|
792
|
+
"""Create a fake ServerInterface.
|
|
1023
793
|
|
|
1024
794
|
:param dict attrs: A dictionary with all attributes
|
|
1025
795
|
:param dict methods: A dictionary with all methods
|
|
1026
|
-
:return: A fake
|
|
1027
|
-
object
|
|
796
|
+
:return: A fake
|
|
797
|
+
:class:`~openstack.compute.v2.server_interface.ServerInterface` object
|
|
1028
798
|
"""
|
|
1029
799
|
attrs = attrs or {}
|
|
1030
800
|
|