python-openstackclient 6.6.1__py3-none-any.whl → 7.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/api/api.py +4 -4
- openstackclient/api/compute_v2.py +352 -638
- openstackclient/api/image_v1.py +1 -1
- openstackclient/api/object_store_v1.py +3 -4
- openstackclient/common/availability_zone.py +1 -1
- openstackclient/common/clientmanager.py +24 -20
- openstackclient/common/configuration.py +1 -1
- openstackclient/common/extension.py +1 -1
- openstackclient/common/limits.py +67 -34
- openstackclient/common/module.py +3 -3
- openstackclient/common/progressbar.py +2 -2
- openstackclient/common/project_cleanup.py +5 -2
- openstackclient/common/quota.py +299 -423
- openstackclient/common/versions.py +1 -1
- openstackclient/compute/client.py +7 -116
- openstackclient/compute/v2/agent.py +75 -49
- openstackclient/compute/v2/aggregate.py +38 -32
- openstackclient/compute/v2/console.py +2 -2
- openstackclient/compute/v2/flavor.py +6 -6
- openstackclient/compute/v2/host.py +38 -33
- openstackclient/compute/v2/hypervisor.py +9 -6
- openstackclient/compute/v2/keypair.py +7 -8
- openstackclient/compute/v2/server.py +479 -396
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_group.py +4 -4
- openstackclient/compute/v2/server_image.py +1 -1
- openstackclient/compute/v2/server_migration.py +3 -4
- openstackclient/compute/v2/service.py +4 -4
- openstackclient/compute/v2/usage.py +3 -3
- openstackclient/identity/common.py +34 -0
- openstackclient/identity/v2_0/catalog.py +2 -2
- openstackclient/identity/v2_0/ec2creds.py +4 -4
- openstackclient/identity/v2_0/endpoint.py +4 -4
- openstackclient/identity/v2_0/project.py +6 -6
- openstackclient/identity/v2_0/role.py +5 -5
- openstackclient/identity/v2_0/role_assignment.py +1 -1
- openstackclient/identity/v2_0/service.py +4 -4
- openstackclient/identity/v2_0/token.py +2 -2
- openstackclient/identity/v2_0/user.py +7 -7
- openstackclient/identity/v3/access_rule.py +3 -3
- openstackclient/identity/v3/application_credential.py +125 -43
- openstackclient/identity/v3/catalog.py +2 -2
- openstackclient/identity/v3/consumer.py +4 -4
- openstackclient/identity/v3/credential.py +5 -5
- openstackclient/identity/v3/domain.py +5 -5
- openstackclient/identity/v3/ec2creds.py +4 -4
- openstackclient/identity/v3/endpoint.py +7 -7
- openstackclient/identity/v3/endpoint_group.py +8 -10
- openstackclient/identity/v3/federation_protocol.py +5 -5
- openstackclient/identity/v3/group.py +8 -8
- openstackclient/identity/v3/identity_provider.py +5 -5
- openstackclient/identity/v3/implied_role.py +3 -3
- openstackclient/identity/v3/limit.py +5 -5
- openstackclient/identity/v3/mapping.py +5 -5
- openstackclient/identity/v3/policy.py +5 -5
- openstackclient/identity/v3/project.py +5 -5
- openstackclient/identity/v3/region.py +5 -5
- openstackclient/identity/v3/registered_limit.py +5 -5
- openstackclient/identity/v3/role.py +7 -7
- openstackclient/identity/v3/role_assignment.py +92 -140
- openstackclient/identity/v3/service.py +64 -34
- openstackclient/identity/v3/service_provider.py +4 -4
- openstackclient/identity/v3/tag.py +2 -2
- openstackclient/identity/v3/token.py +5 -5
- openstackclient/identity/v3/trust.py +3 -3
- openstackclient/identity/v3/user.py +144 -80
- openstackclient/image/client.py +4 -4
- openstackclient/image/v1/image.py +8 -9
- openstackclient/image/v2/cache.py +12 -10
- openstackclient/image/v2/metadef_objects.py +44 -0
- openstackclient/image/v2/metadef_resource_type_association.py +189 -0
- openstackclient/image/v2/task.py +1 -1
- openstackclient/network/common.py +6 -5
- openstackclient/network/utils.py +2 -2
- openstackclient/network/v2/address_group.py +6 -6
- openstackclient/network/v2/address_scope.py +5 -5
- openstackclient/network/v2/default_security_group_rule.py +1 -1
- openstackclient/network/v2/floating_ip.py +8 -10
- openstackclient/network/v2/floating_ip_pool.py +6 -15
- openstackclient/network/v2/floating_ip_port_forwarding.py +5 -13
- openstackclient/network/v2/ip_availability.py +2 -2
- openstackclient/network/v2/l3_conntrack_helper.py +5 -5
- openstackclient/network/v2/network.py +8 -8
- openstackclient/network/v2/network_agent.py +8 -8
- openstackclient/network/v2/network_auto_allocated_topology.py +2 -2
- openstackclient/network/v2/network_flavor.py +6 -8
- openstackclient/network/v2/network_flavor_profile.py +4 -4
- openstackclient/network/v2/network_meter.py +3 -3
- openstackclient/network/v2/network_meter_rule.py +3 -3
- openstackclient/network/v2/network_qos_policy.py +5 -5
- openstackclient/network/v2/network_qos_rule.py +9 -9
- openstackclient/network/v2/network_qos_rule_type.py +1 -1
- openstackclient/network/v2/network_rbac.py +5 -5
- openstackclient/network/v2/network_segment.py +5 -5
- openstackclient/network/v2/network_segment_range.py +7 -7
- openstackclient/network/v2/network_trunk.py +7 -7
- openstackclient/network/v2/port.py +26 -12
- openstackclient/network/v2/router.py +403 -54
- openstackclient/network/v2/security_group.py +18 -14
- openstackclient/network/v2/security_group_rule.py +18 -15
- openstackclient/network/v2/subnet.py +15 -8
- openstackclient/network/v2/subnet_pool.py +6 -6
- openstackclient/object/v1/account.py +2 -2
- openstackclient/object/v1/container.py +7 -7
- openstackclient/object/v1/object.py +7 -7
- openstackclient/releasenotes/notes/volume-backup-created-at-list-b49ec893ae1f6b0d.yaml +4 -0
- openstackclient/shell.py +4 -6
- openstackclient/tests/functional/base.py +1 -1
- openstackclient/tests/functional/common/test_extension.py +1 -1
- openstackclient/tests/functional/common/test_help.py +2 -2
- openstackclient/tests/functional/common/test_module.py +1 -1
- openstackclient/tests/functional/common/test_quota.py +43 -61
- openstackclient/tests/functional/compute/v2/common.py +2 -2
- openstackclient/tests/functional/compute/v2/test_flavor.py +2 -2
- openstackclient/tests/functional/compute/v2/test_keypair.py +1 -1
- openstackclient/tests/functional/compute/v2/test_server.py +5 -5
- openstackclient/tests/functional/compute/v2/test_server_event.py +1 -1
- openstackclient/tests/functional/identity/v2/common.py +3 -3
- openstackclient/tests/functional/identity/v3/common.py +12 -4
- openstackclient/tests/functional/identity/v3/test_application_credential.py +6 -12
- openstackclient/tests/functional/identity/v3/test_domain.py +1 -3
- openstackclient/tests/functional/identity/v3/test_endpoint.py +1 -1
- openstackclient/tests/functional/identity/v3/test_idp.py +1 -1
- openstackclient/tests/functional/identity/v3/test_region.py +1 -3
- openstackclient/tests/functional/identity/v3/test_role.py +2 -2
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +210 -0
- openstackclient/tests/functional/identity/v3/test_service.py +1 -3
- openstackclient/tests/functional/identity/v3/test_service_provider.py +1 -3
- openstackclient/tests/functional/image/base.py +1 -1
- openstackclient/tests/functional/image/v2/test_image.py +1 -1
- openstackclient/tests/functional/image/v2/test_info.py +1 -1
- openstackclient/tests/functional/network/v2/common.py +4 -6
- openstackclient/tests/functional/network/v2/test_network.py +5 -3
- openstackclient/tests/functional/network/v2/test_network_agent.py +7 -5
- openstackclient/tests/functional/network/v2/test_network_qos_rule.py +4 -4
- openstackclient/tests/functional/network/v2/test_port.py +11 -7
- openstackclient/tests/functional/network/v2/test_router.py +2 -2
- openstackclient/tests/functional/object/v1/common.py +1 -1
- openstackclient/tests/functional/object/v1/test_container.py +3 -3
- openstackclient/tests/functional/object/v1/test_object.py +9 -13
- openstackclient/tests/functional/volume/base.py +1 -1
- openstackclient/tests/functional/volume/v1/test_service.py +1 -1
- openstackclient/tests/functional/volume/v1/test_snapshot.py +2 -2
- openstackclient/tests/functional/volume/v1/test_transfer_request.py +2 -2
- openstackclient/tests/functional/volume/v1/test_volume_type.py +1 -1
- openstackclient/tests/functional/volume/v2/test_service.py +2 -2
- openstackclient/tests/functional/volume/v2/test_volume_backup.py +2 -2
- openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +2 -2
- openstackclient/tests/functional/volume/v2/test_volume_type.py +1 -1
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +2 -2
- openstackclient/tests/functional/volume/v3/test_volume_type.py +1 -1
- openstackclient/tests/unit/api/fakes.py +1 -1
- openstackclient/tests/unit/api/test_api.py +2 -2
- openstackclient/tests/unit/api/test_compute_v2.py +522 -707
- openstackclient/tests/unit/api/test_image_v1.py +1 -1
- openstackclient/tests/unit/api/test_image_v2.py +1 -1
- openstackclient/tests/unit/api/test_object_store_v1.py +4 -4
- openstackclient/tests/unit/common/test_limits.py +73 -35
- openstackclient/tests/unit/common/test_logs.py +2 -2
- openstackclient/tests/unit/common/test_module.py +4 -2
- openstackclient/tests/unit/common/test_project_cleanup.py +31 -6
- openstackclient/tests/unit/common/test_quota.py +490 -630
- openstackclient/tests/unit/compute/v2/fakes.py +37 -286
- openstackclient/tests/unit/compute/v2/test_agent.py +189 -147
- openstackclient/tests/unit/compute/v2/test_aggregate.py +87 -57
- openstackclient/tests/unit/compute/v2/test_console.py +4 -5
- openstackclient/tests/unit/compute/v2/test_flavor.py +59 -68
- openstackclient/tests/unit/compute/v2/test_host.py +83 -54
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +57 -34
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +65 -50
- openstackclient/tests/unit/compute/v2/test_server.py +2850 -2453
- openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_event.py +14 -39
- openstackclient/tests/unit/compute/v2/test_server_group.py +28 -29
- openstackclient/tests/unit/compute/v2/test_server_migration.py +43 -68
- openstackclient/tests/unit/compute/v2/test_server_volume.py +17 -34
- openstackclient/tests/unit/compute/v2/test_service.py +34 -52
- openstackclient/tests/unit/compute/v2/test_usage.py +4 -4
- openstackclient/tests/unit/fakes.py +12 -12
- openstackclient/tests/unit/identity/v2_0/fakes.py +27 -10
- openstackclient/tests/unit/identity/v2_0/test_catalog.py +3 -3
- openstackclient/tests/unit/identity/v2_0/test_endpoint.py +7 -7
- openstackclient/tests/unit/identity/v2_0/test_project.py +8 -8
- openstackclient/tests/unit/identity/v2_0/test_role.py +10 -10
- openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +4 -4
- openstackclient/tests/unit/identity/v2_0/test_service.py +6 -6
- openstackclient/tests/unit/identity/v2_0/test_token.py +4 -4
- openstackclient/tests/unit/identity/v2_0/test_user.py +8 -8
- openstackclient/tests/unit/identity/v3/fakes.py +59 -20
- openstackclient/tests/unit/identity/v3/test_access_rule.py +5 -5
- openstackclient/tests/unit/identity/v3/test_application_credential.py +207 -230
- openstackclient/tests/unit/identity/v3/test_catalog.py +3 -3
- openstackclient/tests/unit/identity/v3/test_consumer.py +7 -8
- openstackclient/tests/unit/identity/v3/test_credential.py +9 -9
- openstackclient/tests/unit/identity/v3/test_domain.py +8 -8
- openstackclient/tests/unit/identity/v3/test_endpoint.py +13 -13
- openstackclient/tests/unit/identity/v3/test_endpoint_group.py +12 -14
- openstackclient/tests/unit/identity/v3/test_group.py +12 -12
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +8 -8
- openstackclient/tests/unit/identity/v3/test_implied_role.py +5 -5
- openstackclient/tests/unit/identity/v3/test_limit.py +7 -7
- openstackclient/tests/unit/identity/v3/test_mappings.py +7 -7
- openstackclient/tests/unit/identity/v3/test_oauth.py +5 -5
- openstackclient/tests/unit/identity/v3/test_project.py +16 -16
- openstackclient/tests/unit/identity/v3/test_protocol.py +7 -7
- openstackclient/tests/unit/identity/v3/test_region.py +7 -7
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +12 -13
- openstackclient/tests/unit/identity/v3/test_role.py +13 -13
- openstackclient/tests/unit/identity/v3/test_role_assignment.py +410 -331
- openstackclient/tests/unit/identity/v3/test_service.py +90 -94
- openstackclient/tests/unit/identity/v3/test_service_provider.py +7 -7
- openstackclient/tests/unit/identity/v3/test_token.py +4 -4
- openstackclient/tests/unit/identity/v3/test_trust.py +9 -9
- openstackclient/tests/unit/identity/v3/test_unscoped_saml.py +4 -4
- openstackclient/tests/unit/identity/v3/test_user.py +299 -327
- openstackclient/tests/unit/image/v1/test_image.py +6 -6
- openstackclient/tests/unit/image/v2/fakes.py +46 -9
- openstackclient/tests/unit/image/v2/test_cache.py +2 -2
- openstackclient/tests/unit/image/v2/test_image.py +3 -3
- openstackclient/tests/unit/image/v2/test_metadef_objects.py +62 -0
- openstackclient/tests/unit/image/v2/test_metadef_resource_type_association.py +131 -0
- openstackclient/tests/unit/integ/base.py +1 -1
- openstackclient/tests/unit/integ/cli/test_project.py +4 -4
- openstackclient/tests/unit/integ/cli/test_shell.py +7 -7
- openstackclient/tests/unit/network/test_common.py +12 -21
- openstackclient/tests/unit/network/v2/fakes.py +64 -130
- openstackclient/tests/unit/network/v2/test_address_group.py +15 -15
- openstackclient/tests/unit/network/v2/test_address_scope.py +13 -13
- openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +49 -27
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +40 -38
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +15 -15
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +4 -7
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +3 -5
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +11 -11
- openstackclient/tests/unit/network/v2/test_ip_availability.py +6 -6
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +11 -21
- openstackclient/tests/unit/network/v2/test_local_ip.py +7 -7
- openstackclient/tests/unit/network/v2/test_local_ip_association.py +3 -5
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +13 -13
- openstackclient/tests/unit/network/v2/test_network.py +23 -28
- openstackclient/tests/unit/network/v2/test_network_agent.py +17 -21
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +8 -8
- openstackclient/tests/unit/network/v2/test_network_compute.py +66 -65
- openstackclient/tests/unit/network/v2/test_network_flavor.py +17 -19
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +13 -13
- openstackclient/tests/unit/network/v2/test_network_meter.py +11 -11
- openstackclient/tests/unit/network/v2/test_network_meter_rule.py +11 -11
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +11 -21
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +51 -77
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +5 -9
- openstackclient/tests/unit/network/v2/test_network_rbac.py +12 -12
- openstackclient/tests/unit/network/v2/test_network_segment.py +11 -15
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +11 -13
- openstackclient/tests/unit/network/v2/test_network_service_provider.py +3 -5
- openstackclient/tests/unit/network/v2/test_network_trunk.py +11 -11
- openstackclient/tests/unit/network/v2/test_port.py +22 -25
- openstackclient/tests/unit/network/v2/test_router.py +721 -51
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +65 -49
- openstackclient/tests/unit/network/v2/test_security_group_network.py +15 -15
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +57 -45
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +11 -19
- openstackclient/tests/unit/network/v2/test_subnet.py +29 -25
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +15 -15
- openstackclient/tests/unit/object/v1/fakes.py +1 -1
- openstackclient/tests/unit/object/v1/test_container.py +5 -5
- openstackclient/tests/unit/object/v1/test_container_all.py +6 -6
- openstackclient/tests/unit/object/v1/test_object.py +3 -3
- openstackclient/tests/unit/object/v1/test_object_all.py +5 -5
- openstackclient/tests/unit/test_shell.py +5 -5
- openstackclient/tests/unit/utils.py +4 -1
- openstackclient/tests/unit/volume/test_find_resource.py +2 -2
- openstackclient/tests/unit/volume/v1/fakes.py +5 -6
- openstackclient/tests/unit/volume/v1/test_volume.py +5 -4
- openstackclient/tests/unit/volume/v2/fakes.py +39 -259
- openstackclient/tests/unit/volume/v2/test_consistency_group_snapshot.py +5 -5
- openstackclient/tests/unit/volume/v2/test_qos_specs.py +9 -9
- openstackclient/tests/unit/volume/v2/test_volume.py +21 -87
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +10 -368
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +1 -1
- openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +0 -44
- openstackclient/tests/unit/volume/v2/test_volume_type.py +6 -87
- openstackclient/tests/unit/volume/v3/fakes.py +505 -22
- openstackclient/tests/unit/volume/v3/test_block_storage_cleanup.py +2 -3
- openstackclient/tests/unit/volume/v3/test_block_storage_cluster.py +10 -11
- openstackclient/tests/unit/volume/v3/test_block_storage_log_level.py +10 -6
- openstackclient/tests/unit/volume/v3/test_block_storage_manage.py +25 -17
- openstackclient/tests/unit/volume/v3/test_block_storage_resource_filter.py +6 -32
- openstackclient/tests/unit/volume/v3/test_service.py +271 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +2177 -33
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +48 -52
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +892 -0
- openstackclient/tests/unit/volume/v3/test_volume_group.py +19 -20
- openstackclient/tests/unit/volume/v3/test_volume_group_snapshot.py +14 -34
- openstackclient/tests/unit/volume/v3/test_volume_group_type.py +13 -16
- openstackclient/tests/unit/volume/v3/test_volume_message.py +10 -11
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +161 -0
- openstackclient/tests/unit/volume/v3/test_volume_transfer_request.py +425 -0
- openstackclient/tests/unit/volume/v3/test_volume_type.py +1109 -0
- openstackclient/volume/v1/qos_specs.py +7 -7
- openstackclient/volume/v1/service.py +2 -2
- openstackclient/volume/v1/volume.py +12 -12
- openstackclient/volume/v1/volume_backup.py +7 -7
- openstackclient/volume/v1/volume_snapshot.py +8 -8
- openstackclient/volume/v1/volume_transfer_request.py +5 -5
- openstackclient/volume/v1/volume_type.py +7 -7
- openstackclient/volume/v2/backup_record.py +2 -2
- openstackclient/volume/v2/consistency_group.py +7 -9
- openstackclient/volume/v2/consistency_group_snapshot.py +4 -12
- openstackclient/volume/v2/qos_specs.py +7 -7
- openstackclient/volume/v2/service.py +2 -2
- openstackclient/volume/v2/volume.py +80 -80
- openstackclient/volume/v2/volume_backend.py +2 -2
- openstackclient/volume/v2/volume_backup.py +9 -217
- openstackclient/volume/v2/volume_host.py +2 -2
- openstackclient/volume/v2/volume_snapshot.py +8 -8
- openstackclient/volume/v2/volume_transfer_request.py +5 -37
- openstackclient/volume/v2/volume_type.py +7 -89
- openstackclient/volume/v3/service.py +56 -0
- openstackclient/volume/v3/volume.py +971 -0
- openstackclient/volume/v3/volume_attachment.py +31 -29
- openstackclient/volume/v3/volume_backup.py +670 -0
- openstackclient/volume/v3/volume_message.py +1 -1
- openstackclient/volume/v3/volume_snapshot.py +97 -0
- openstackclient/volume/v3/volume_transfer_request.py +233 -0
- openstackclient/volume/v3/volume_type.py +967 -0
- {python_openstackclient-6.6.1.dist-info → python_openstackclient-7.1.0.dist-info}/AUTHORS +6 -0
- {python_openstackclient-6.6.1.dist-info → python_openstackclient-7.1.0.dist-info}/METADATA +4 -4
- python_openstackclient-7.1.0.dist-info/RECORD +503 -0
- {python_openstackclient-6.6.1.dist-info → python_openstackclient-7.1.0.dist-info}/entry_points.txt +33 -27
- python_openstackclient-7.1.0.dist-info/pbr.json +1 -0
- python_openstackclient-6.6.1.dist-info/RECORD +0 -489
- python_openstackclient-6.6.1.dist-info/pbr.json +0 -1
- {python_openstackclient-6.6.1.dist-info → python_openstackclient-7.1.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-6.6.1.dist-info → python_openstackclient-7.1.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-6.6.1.dist-info → python_openstackclient-7.1.0.dist-info}/top_level.txt +0 -0
|
@@ -10,61 +10,38 @@
|
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
12
|
|
|
13
|
-
import copy
|
|
14
13
|
from unittest import mock
|
|
15
14
|
|
|
16
|
-
from
|
|
15
|
+
from openstack.block_storage.v3 import quota_set as _volume_quota_set
|
|
16
|
+
from openstack.compute.v2 import quota_set as _compute_quota_set
|
|
17
|
+
from openstack.identity.v3 import project as _project
|
|
18
|
+
from openstack.network.v2 import quota as _network_quota_set
|
|
19
|
+
from openstack.test import fakes as sdk_fakes
|
|
17
20
|
|
|
21
|
+
from openstack import exceptions as sdk_exceptions
|
|
18
22
|
from openstackclient.common import quota
|
|
19
23
|
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
|
|
20
|
-
from openstackclient.tests.unit import fakes
|
|
21
|
-
from openstackclient.tests.unit.identity.v2_0 import fakes as identity_fakes
|
|
22
|
-
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes_v3
|
|
24
|
+
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
|
|
23
25
|
from openstackclient.tests.unit.network.v2 import fakes as network_fakes
|
|
24
|
-
from openstackclient.tests.unit
|
|
26
|
+
from openstackclient.tests.unit import utils
|
|
27
|
+
from openstackclient.tests.unit.volume.v3 import fakes as volume_fakes
|
|
25
28
|
|
|
26
29
|
|
|
27
|
-
class
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
for key in keys:
|
|
35
|
-
self._keys.pop(key, None)
|
|
36
|
-
|
|
37
|
-
def get_keys(self):
|
|
38
|
-
return self._keys
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class TestQuota(compute_fakes.TestComputev2):
|
|
30
|
+
class TestQuota(
|
|
31
|
+
identity_fakes.FakeClientMixin,
|
|
32
|
+
compute_fakes.FakeClientMixin,
|
|
33
|
+
network_fakes.FakeClientMixin,
|
|
34
|
+
volume_fakes.FakeClientMixin,
|
|
35
|
+
utils.TestCommand,
|
|
36
|
+
):
|
|
42
37
|
def setUp(self):
|
|
43
|
-
super(
|
|
44
|
-
|
|
45
|
-
# Set up common projects
|
|
46
|
-
self.projects = identity_fakes_v3.FakeProject.create_projects(count=2)
|
|
47
|
-
self.projects_mock = self.app.client_manager.identity.projects
|
|
48
|
-
self.projects_mock.reset_mock()
|
|
49
|
-
self.projects_mock.get.return_value = self.projects[0]
|
|
50
|
-
|
|
51
|
-
self.compute_quotas_mock = self.compute_client.quotas
|
|
52
|
-
self.compute_quotas_mock.reset_mock()
|
|
53
|
-
self.compute_quotas_class_mock = self.compute_client.quota_classes
|
|
54
|
-
self.compute_quotas_class_mock.reset_mock()
|
|
55
|
-
|
|
56
|
-
self.volume_quotas_mock = self.volume_client.quotas
|
|
57
|
-
self.volume_quotas_mock.reset_mock()
|
|
58
|
-
self.volume_quotas_class_mock = self.volume_client.quota_classes
|
|
59
|
-
self.volume_quotas_class_mock.reset_mock()
|
|
38
|
+
super().setUp()
|
|
60
39
|
|
|
61
|
-
self.
|
|
62
|
-
|
|
63
|
-
self.service_catalog_mock = (
|
|
64
|
-
self.app.client_manager.auth_ref.service_catalog
|
|
40
|
+
self.projects = list(
|
|
41
|
+
sdk_fakes.generate_fake_resources(_project.Project, count=2)
|
|
65
42
|
)
|
|
66
|
-
self.
|
|
67
|
-
self.app.client_manager.auth_ref.project_id =
|
|
43
|
+
self.app.client_manager.auth_ref = mock.Mock()
|
|
44
|
+
self.app.client_manager.auth_ref.project_id = self.projects[1].id
|
|
68
45
|
|
|
69
46
|
|
|
70
47
|
class TestQuotaList(TestQuota):
|
|
@@ -73,7 +50,6 @@ class TestQuotaList(TestQuota):
|
|
|
73
50
|
compute_column_header = (
|
|
74
51
|
'Project ID',
|
|
75
52
|
'Cores',
|
|
76
|
-
'Fixed IPs',
|
|
77
53
|
'Injected Files',
|
|
78
54
|
'Injected File Content Bytes',
|
|
79
55
|
'Injected File Path Bytes',
|
|
@@ -109,28 +85,25 @@ class TestQuotaList(TestQuota):
|
|
|
109
85
|
)
|
|
110
86
|
|
|
111
87
|
def setUp(self):
|
|
112
|
-
super(
|
|
88
|
+
super().setUp()
|
|
113
89
|
|
|
114
|
-
|
|
115
|
-
self.
|
|
116
|
-
self.projects_mock.list.return_value = self.projects
|
|
90
|
+
self.identity_sdk_client.get_project.side_effect = self.projects[0]
|
|
91
|
+
self.identity_sdk_client.projects.return_value = self.projects
|
|
117
92
|
|
|
118
93
|
self.compute_quotas = [
|
|
119
|
-
|
|
120
|
-
|
|
94
|
+
sdk_fakes.generate_fake_resource(_compute_quota_set.QuotaSet),
|
|
95
|
+
sdk_fakes.generate_fake_resource(_compute_quota_set.QuotaSet),
|
|
121
96
|
]
|
|
122
|
-
self.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
self.
|
|
127
|
-
|
|
97
|
+
self.default_compute_quotas = sdk_fakes.generate_fake_resource(
|
|
98
|
+
_compute_quota_set.QuotaSet
|
|
99
|
+
)
|
|
100
|
+
# the defaults are global hence use of return_value here
|
|
101
|
+
self.compute_sdk_client.get_quota_set_defaults.return_value = (
|
|
102
|
+
self.default_compute_quotas
|
|
128
103
|
)
|
|
129
|
-
|
|
130
104
|
self.compute_reference_data = (
|
|
131
105
|
self.projects[0].id,
|
|
132
106
|
self.compute_quotas[0].cores,
|
|
133
|
-
self.compute_quotas[0].fixed_ips,
|
|
134
107
|
self.compute_quotas[0].injected_files,
|
|
135
108
|
self.compute_quotas[0].injected_file_content_bytes,
|
|
136
109
|
self.compute_quotas[0].injected_file_path_bytes,
|
|
@@ -143,17 +116,16 @@ class TestQuotaList(TestQuota):
|
|
|
143
116
|
)
|
|
144
117
|
|
|
145
118
|
self.network_quotas = [
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
]
|
|
149
|
-
self.network_default_quotas = [
|
|
150
|
-
network_fakes.FakeQuota.create_one_default_net_quota(),
|
|
151
|
-
network_fakes.FakeQuota.create_one_default_net_quota(),
|
|
119
|
+
sdk_fakes.generate_fake_resource(_network_quota_set.Quota),
|
|
120
|
+
sdk_fakes.generate_fake_resource(_network_quota_set.Quota),
|
|
152
121
|
]
|
|
153
|
-
self.
|
|
154
|
-
|
|
122
|
+
self.default_network_quotas = sdk_fakes.generate_fake_resource(
|
|
123
|
+
_network_quota_set.QuotaDefault
|
|
124
|
+
)
|
|
125
|
+
# the defaults are global hence use of return_value here
|
|
126
|
+
self.network_client.get_quota_default.return_value = (
|
|
127
|
+
self.default_network_quotas
|
|
155
128
|
)
|
|
156
|
-
|
|
157
129
|
self.network_reference_data = (
|
|
158
130
|
self.projects[0].id,
|
|
159
131
|
self.network_quotas[0].floating_ips,
|
|
@@ -168,17 +140,16 @@ class TestQuotaList(TestQuota):
|
|
|
168
140
|
)
|
|
169
141
|
|
|
170
142
|
self.volume_quotas = [
|
|
171
|
-
|
|
172
|
-
|
|
143
|
+
sdk_fakes.generate_fake_resource(_volume_quota_set.QuotaSet),
|
|
144
|
+
sdk_fakes.generate_fake_resource(_volume_quota_set.QuotaSet),
|
|
173
145
|
]
|
|
174
|
-
self.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
self.
|
|
179
|
-
|
|
146
|
+
self.default_volume_quotas = sdk_fakes.generate_fake_resource(
|
|
147
|
+
_volume_quota_set.QuotaSet
|
|
148
|
+
)
|
|
149
|
+
# the defaults are global hence use of return_value here
|
|
150
|
+
self.volume_sdk_client.get_quota_set_defaults.return_value = (
|
|
151
|
+
self.default_volume_quotas
|
|
180
152
|
)
|
|
181
|
-
|
|
182
153
|
self.volume_reference_data = (
|
|
183
154
|
self.projects[0].id,
|
|
184
155
|
self.volume_quotas[0].backups,
|
|
@@ -191,120 +162,9 @@ class TestQuotaList(TestQuota):
|
|
|
191
162
|
|
|
192
163
|
self.cmd = quota.ListQuota(self.app, None)
|
|
193
164
|
|
|
194
|
-
@staticmethod
|
|
195
|
-
def _get_detailed_reference_data(quota):
|
|
196
|
-
reference_data = []
|
|
197
|
-
for name, values in quota.to_dict().items():
|
|
198
|
-
if type(values) is dict:
|
|
199
|
-
if 'used' in values:
|
|
200
|
-
# For network quota it's "used" key instead of "in_use"
|
|
201
|
-
in_use = values['used']
|
|
202
|
-
else:
|
|
203
|
-
in_use = values['in_use']
|
|
204
|
-
resource_values = [in_use, values['reserved'], values['limit']]
|
|
205
|
-
reference_data.append(tuple([name] + resource_values))
|
|
206
|
-
return reference_data
|
|
207
|
-
|
|
208
|
-
def test_quota_list_details_compute(self):
|
|
209
|
-
detailed_quota = compute_fakes.create_one_comp_detailed_quota()
|
|
210
|
-
|
|
211
|
-
detailed_column_header = (
|
|
212
|
-
'Resource',
|
|
213
|
-
'In Use',
|
|
214
|
-
'Reserved',
|
|
215
|
-
'Limit',
|
|
216
|
-
)
|
|
217
|
-
detailed_reference_data = self._get_detailed_reference_data(
|
|
218
|
-
detailed_quota
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
self.compute_client.quotas.get = mock.Mock(return_value=detailed_quota)
|
|
222
|
-
|
|
223
|
-
arglist = [
|
|
224
|
-
'--detail',
|
|
225
|
-
'--compute',
|
|
226
|
-
]
|
|
227
|
-
verifylist = [
|
|
228
|
-
('detail', True),
|
|
229
|
-
('compute', True),
|
|
230
|
-
]
|
|
231
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
232
|
-
|
|
233
|
-
columns, data = self.cmd.take_action(parsed_args)
|
|
234
|
-
ret_quotas = list(data)
|
|
235
|
-
|
|
236
|
-
self.assertEqual(detailed_column_header, columns)
|
|
237
|
-
self.assertEqual(sorted(detailed_reference_data), sorted(ret_quotas))
|
|
238
|
-
|
|
239
|
-
def test_quota_list_details_network(self):
|
|
240
|
-
detailed_quota = (
|
|
241
|
-
network_fakes.FakeQuota.create_one_net_detailed_quota()
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
detailed_column_header = (
|
|
245
|
-
'Resource',
|
|
246
|
-
'In Use',
|
|
247
|
-
'Reserved',
|
|
248
|
-
'Limit',
|
|
249
|
-
)
|
|
250
|
-
detailed_reference_data = self._get_detailed_reference_data(
|
|
251
|
-
detailed_quota
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
self.network_client.get_quota = mock.Mock(return_value=detailed_quota)
|
|
255
|
-
|
|
256
|
-
arglist = [
|
|
257
|
-
'--detail',
|
|
258
|
-
'--network',
|
|
259
|
-
]
|
|
260
|
-
verifylist = [
|
|
261
|
-
('detail', True),
|
|
262
|
-
('network', True),
|
|
263
|
-
]
|
|
264
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
265
|
-
|
|
266
|
-
columns, data = self.cmd.take_action(parsed_args)
|
|
267
|
-
ret_quotas = list(data)
|
|
268
|
-
|
|
269
|
-
self.assertEqual(detailed_column_header, columns)
|
|
270
|
-
self.assertEqual(sorted(detailed_reference_data), sorted(ret_quotas))
|
|
271
|
-
|
|
272
|
-
def test_quota_list_details_volume(self):
|
|
273
|
-
detailed_quota = volume_fakes.create_one_detailed_quota()
|
|
274
|
-
|
|
275
|
-
detailed_column_header = (
|
|
276
|
-
'Resource',
|
|
277
|
-
'In Use',
|
|
278
|
-
'Reserved',
|
|
279
|
-
'Limit',
|
|
280
|
-
)
|
|
281
|
-
detailed_reference_data = self._get_detailed_reference_data(
|
|
282
|
-
detailed_quota
|
|
283
|
-
)
|
|
284
|
-
|
|
285
|
-
self.volume_client.quotas.get = mock.Mock(return_value=detailed_quota)
|
|
286
|
-
|
|
287
|
-
arglist = [
|
|
288
|
-
'--detail',
|
|
289
|
-
'--volume',
|
|
290
|
-
]
|
|
291
|
-
verifylist = [
|
|
292
|
-
('detail', True),
|
|
293
|
-
('volume', True),
|
|
294
|
-
]
|
|
295
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
296
|
-
|
|
297
|
-
columns, data = self.cmd.take_action(parsed_args)
|
|
298
|
-
ret_quotas = list(data)
|
|
299
|
-
|
|
300
|
-
self.assertEqual(detailed_column_header, columns)
|
|
301
|
-
self.assertEqual(sorted(detailed_reference_data), sorted(ret_quotas))
|
|
302
|
-
|
|
303
165
|
def test_quota_list_compute(self):
|
|
304
166
|
# Two projects with non-default quotas
|
|
305
|
-
self.
|
|
306
|
-
side_effect=self.compute_quotas,
|
|
307
|
-
)
|
|
167
|
+
self.compute_sdk_client.get_quota_set.side_effect = self.compute_quotas
|
|
308
168
|
|
|
309
169
|
arglist = [
|
|
310
170
|
'--compute',
|
|
@@ -323,12 +183,10 @@ class TestQuotaList(TestQuota):
|
|
|
323
183
|
|
|
324
184
|
def test_quota_list_compute_default(self):
|
|
325
185
|
# One of the projects is at defaults
|
|
326
|
-
self.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
],
|
|
331
|
-
)
|
|
186
|
+
self.compute_sdk_client.get_quota_set.side_effect = [
|
|
187
|
+
self.compute_quotas[0],
|
|
188
|
+
self.default_compute_quotas,
|
|
189
|
+
]
|
|
332
190
|
|
|
333
191
|
arglist = [
|
|
334
192
|
'--compute',
|
|
@@ -345,14 +203,12 @@ class TestQuotaList(TestQuota):
|
|
|
345
203
|
self.assertEqual(self.compute_reference_data, ret_quotas[0])
|
|
346
204
|
self.assertEqual(1, len(ret_quotas))
|
|
347
205
|
|
|
348
|
-
def
|
|
206
|
+
def test_quota_list_compute_project_not_found(self):
|
|
349
207
|
# Make one of the projects disappear
|
|
350
|
-
self.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
],
|
|
355
|
-
)
|
|
208
|
+
self.compute_sdk_client.get_quota_set.side_effect = [
|
|
209
|
+
self.compute_quotas[0],
|
|
210
|
+
sdk_exceptions.NotFoundException("NotFound"),
|
|
211
|
+
]
|
|
356
212
|
|
|
357
213
|
arglist = [
|
|
358
214
|
'--compute',
|
|
@@ -369,14 +225,12 @@ class TestQuotaList(TestQuota):
|
|
|
369
225
|
self.assertEqual(self.compute_reference_data, ret_quotas[0])
|
|
370
226
|
self.assertEqual(1, len(ret_quotas))
|
|
371
227
|
|
|
372
|
-
def
|
|
373
|
-
# Make one of the projects
|
|
374
|
-
self.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
],
|
|
379
|
-
)
|
|
228
|
+
def test_quota_list_compute_project_inaccessible(self):
|
|
229
|
+
# Make one of the projects inaccessible
|
|
230
|
+
self.compute_sdk_client.get_quota_set.side_effect = [
|
|
231
|
+
self.compute_quotas[0],
|
|
232
|
+
sdk_exceptions.ForbiddenException("Forbidden"),
|
|
233
|
+
]
|
|
380
234
|
|
|
381
235
|
arglist = [
|
|
382
236
|
'--compute',
|
|
@@ -393,13 +247,10 @@ class TestQuotaList(TestQuota):
|
|
|
393
247
|
self.assertEqual(self.compute_reference_data, ret_quotas[0])
|
|
394
248
|
self.assertEqual(1, len(ret_quotas))
|
|
395
249
|
|
|
396
|
-
def
|
|
397
|
-
# Make
|
|
398
|
-
self.
|
|
399
|
-
|
|
400
|
-
self.compute_quotas[0],
|
|
401
|
-
exceptions.HTTPNotImplemented("Not implemented??"),
|
|
402
|
-
],
|
|
250
|
+
def test_quota_list_compute_server_error(self):
|
|
251
|
+
# Make the server "break"
|
|
252
|
+
self.compute_sdk_client.get_quota_set.side_effect = (
|
|
253
|
+
sdk_exceptions.HttpException("Not implemented?")
|
|
403
254
|
)
|
|
404
255
|
|
|
405
256
|
arglist = [
|
|
@@ -411,40 +262,14 @@ class TestQuotaList(TestQuota):
|
|
|
411
262
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
412
263
|
|
|
413
264
|
self.assertRaises(
|
|
414
|
-
|
|
265
|
+
sdk_exceptions.HttpException,
|
|
415
266
|
self.cmd.take_action,
|
|
416
267
|
parsed_args,
|
|
417
268
|
)
|
|
418
269
|
|
|
419
|
-
def test_quota_list_compute_by_project(self):
|
|
420
|
-
# Two projects with non-default quotas
|
|
421
|
-
self.compute_client.quotas.get = mock.Mock(
|
|
422
|
-
side_effect=self.compute_quotas,
|
|
423
|
-
)
|
|
424
|
-
|
|
425
|
-
arglist = [
|
|
426
|
-
'--compute',
|
|
427
|
-
'--project',
|
|
428
|
-
self.projects[0].name,
|
|
429
|
-
]
|
|
430
|
-
verifylist = [
|
|
431
|
-
('compute', True),
|
|
432
|
-
('project', self.projects[0].name),
|
|
433
|
-
]
|
|
434
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
435
|
-
|
|
436
|
-
columns, data = self.cmd.take_action(parsed_args)
|
|
437
|
-
ret_quotas = list(data)
|
|
438
|
-
|
|
439
|
-
self.assertEqual(self.compute_column_header, columns)
|
|
440
|
-
self.assertEqual(self.compute_reference_data, ret_quotas[0])
|
|
441
|
-
self.assertEqual(1, len(ret_quotas))
|
|
442
|
-
|
|
443
270
|
def test_quota_list_network(self):
|
|
444
271
|
# Two projects with non-default quotas
|
|
445
|
-
self.network_client.get_quota =
|
|
446
|
-
side_effect=self.network_quotas,
|
|
447
|
-
)
|
|
272
|
+
self.network_client.get_quota.side_effect = self.network_quotas
|
|
448
273
|
|
|
449
274
|
arglist = [
|
|
450
275
|
'--network',
|
|
@@ -463,12 +288,10 @@ class TestQuotaList(TestQuota):
|
|
|
463
288
|
|
|
464
289
|
def test_quota_list_network_default(self):
|
|
465
290
|
# Two projects with non-default quotas
|
|
466
|
-
self.network_client.get_quota =
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
],
|
|
471
|
-
)
|
|
291
|
+
self.network_client.get_quota.side_effect = [
|
|
292
|
+
self.network_quotas[0],
|
|
293
|
+
self.default_network_quotas,
|
|
294
|
+
]
|
|
472
295
|
|
|
473
296
|
arglist = [
|
|
474
297
|
'--network',
|
|
@@ -487,42 +310,16 @@ class TestQuotaList(TestQuota):
|
|
|
487
310
|
|
|
488
311
|
def test_quota_list_network_no_project(self):
|
|
489
312
|
# Two projects with non-default quotas
|
|
490
|
-
self.network_client.get_quota =
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
exceptions.NotFound("NotFound"),
|
|
494
|
-
],
|
|
495
|
-
)
|
|
496
|
-
|
|
497
|
-
arglist = [
|
|
498
|
-
'--network',
|
|
313
|
+
self.network_client.get_quota.side_effect = [
|
|
314
|
+
self.network_quotas[0],
|
|
315
|
+
sdk_exceptions.NotFoundException("NotFound"),
|
|
499
316
|
]
|
|
500
|
-
verifylist = [
|
|
501
|
-
('network', True),
|
|
502
|
-
]
|
|
503
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
504
|
-
|
|
505
|
-
columns, data = self.cmd.take_action(parsed_args)
|
|
506
|
-
ret_quotas = list(data)
|
|
507
|
-
|
|
508
|
-
self.assertEqual(self.network_column_header, columns)
|
|
509
|
-
self.assertEqual(self.network_reference_data, ret_quotas[0])
|
|
510
|
-
self.assertEqual(1, len(ret_quotas))
|
|
511
|
-
|
|
512
|
-
def test_quota_list_network_by_project(self):
|
|
513
|
-
# Two projects with non-default quotas
|
|
514
|
-
self.network_client.get_quota = mock.Mock(
|
|
515
|
-
side_effect=self.network_quotas,
|
|
516
|
-
)
|
|
517
317
|
|
|
518
318
|
arglist = [
|
|
519
319
|
'--network',
|
|
520
|
-
'--project',
|
|
521
|
-
self.projects[0].name,
|
|
522
320
|
]
|
|
523
321
|
verifylist = [
|
|
524
322
|
('network', True),
|
|
525
|
-
('project', self.projects[0].name),
|
|
526
323
|
]
|
|
527
324
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
528
325
|
|
|
@@ -535,9 +332,7 @@ class TestQuotaList(TestQuota):
|
|
|
535
332
|
|
|
536
333
|
def test_quota_list_volume(self):
|
|
537
334
|
# Two projects with non-default quotas
|
|
538
|
-
self.
|
|
539
|
-
side_effect=self.volume_quotas,
|
|
540
|
-
)
|
|
335
|
+
self.volume_sdk_client.get_quota_set.side_effect = self.volume_quotas
|
|
541
336
|
|
|
542
337
|
arglist = [
|
|
543
338
|
'--volume',
|
|
@@ -556,66 +351,16 @@ class TestQuotaList(TestQuota):
|
|
|
556
351
|
|
|
557
352
|
def test_quota_list_volume_default(self):
|
|
558
353
|
# Two projects with non-default quotas
|
|
559
|
-
self.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
volume_fakes.create_one_default_vol_quota(),
|
|
563
|
-
],
|
|
564
|
-
)
|
|
565
|
-
|
|
566
|
-
arglist = [
|
|
567
|
-
'--volume',
|
|
568
|
-
]
|
|
569
|
-
verifylist = [
|
|
570
|
-
('volume', True),
|
|
354
|
+
self.volume_sdk_client.get_quota_set.side_effect = [
|
|
355
|
+
self.volume_quotas[0],
|
|
356
|
+
self.default_volume_quotas,
|
|
571
357
|
]
|
|
572
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
573
|
-
|
|
574
|
-
columns, data = self.cmd.take_action(parsed_args)
|
|
575
|
-
ret_quotas = list(data)
|
|
576
|
-
|
|
577
|
-
self.assertEqual(self.volume_column_header, columns)
|
|
578
|
-
self.assertEqual(self.volume_reference_data, ret_quotas[0])
|
|
579
|
-
self.assertEqual(1, len(ret_quotas))
|
|
580
|
-
|
|
581
|
-
def test_quota_list_volume_no_project(self):
|
|
582
|
-
# Two projects with non-default quotas
|
|
583
|
-
self.volume_client.quotas.get = mock.Mock(
|
|
584
|
-
side_effect=[
|
|
585
|
-
self.volume_quotas[0],
|
|
586
|
-
volume_fakes.create_one_default_vol_quota(),
|
|
587
|
-
],
|
|
588
|
-
)
|
|
589
|
-
|
|
590
|
-
arglist = [
|
|
591
|
-
'--volume',
|
|
592
|
-
]
|
|
593
|
-
verifylist = [
|
|
594
|
-
('volume', True),
|
|
595
|
-
]
|
|
596
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
597
|
-
|
|
598
|
-
columns, data = self.cmd.take_action(parsed_args)
|
|
599
|
-
ret_quotas = list(data)
|
|
600
|
-
|
|
601
|
-
self.assertEqual(self.volume_column_header, columns)
|
|
602
|
-
self.assertEqual(self.volume_reference_data, ret_quotas[0])
|
|
603
|
-
self.assertEqual(1, len(ret_quotas))
|
|
604
|
-
|
|
605
|
-
def test_quota_list_volume_by_project(self):
|
|
606
|
-
# Two projects with non-default quotas
|
|
607
|
-
self.volume_client.quotas.get = mock.Mock(
|
|
608
|
-
side_effect=self.volume_quotas,
|
|
609
|
-
)
|
|
610
358
|
|
|
611
359
|
arglist = [
|
|
612
360
|
'--volume',
|
|
613
|
-
'--project',
|
|
614
|
-
self.projects[0].name,
|
|
615
361
|
]
|
|
616
362
|
verifylist = [
|
|
617
363
|
('volume', True),
|
|
618
|
-
('project', self.projects[0].name),
|
|
619
364
|
]
|
|
620
365
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
621
366
|
|
|
@@ -629,82 +374,78 @@ class TestQuotaList(TestQuota):
|
|
|
629
374
|
|
|
630
375
|
class TestQuotaSet(TestQuota):
|
|
631
376
|
def setUp(self):
|
|
632
|
-
super(
|
|
633
|
-
|
|
634
|
-
self.compute_quotas_mock.update.return_value = FakeQuotaResource(
|
|
635
|
-
None,
|
|
636
|
-
copy.deepcopy(compute_fakes.QUOTA),
|
|
637
|
-
loaded=True,
|
|
638
|
-
)
|
|
639
|
-
self.compute_quotas_class_mock.update.return_value = FakeQuotaResource(
|
|
640
|
-
None,
|
|
641
|
-
copy.deepcopy(compute_fakes.QUOTA),
|
|
642
|
-
loaded=True,
|
|
643
|
-
)
|
|
377
|
+
super().setUp()
|
|
644
378
|
|
|
645
|
-
self.
|
|
646
|
-
None,
|
|
647
|
-
copy.deepcopy(compute_fakes.QUOTA),
|
|
648
|
-
loaded=True,
|
|
649
|
-
)
|
|
650
|
-
self.volume_quotas_class_mock.update.return_value = FakeQuotaResource(
|
|
651
|
-
None,
|
|
652
|
-
copy.deepcopy(compute_fakes.QUOTA),
|
|
653
|
-
loaded=True,
|
|
654
|
-
)
|
|
379
|
+
self.identity_sdk_client.find_project.return_value = self.projects[0]
|
|
655
380
|
|
|
656
381
|
self.cmd = quota.SetQuota(self.app, None)
|
|
657
382
|
|
|
658
383
|
def test_quota_set(self):
|
|
384
|
+
floating_ip_num = 100
|
|
385
|
+
fix_ip_num = 100
|
|
386
|
+
injected_file_num = 100
|
|
387
|
+
injected_file_size_num = 10240
|
|
388
|
+
injected_path_size_num = 255
|
|
389
|
+
key_pair_num = 100
|
|
390
|
+
core_num = 20
|
|
391
|
+
ram_num = 51200
|
|
392
|
+
instance_num = 10
|
|
393
|
+
property_num = 128
|
|
394
|
+
secgroup_rule_num = 20
|
|
395
|
+
secgroup_num = 10
|
|
396
|
+
servgroup_num = 10
|
|
397
|
+
servgroup_members_num = 10
|
|
398
|
+
|
|
659
399
|
arglist = [
|
|
660
400
|
'--floating-ips',
|
|
661
|
-
str(
|
|
401
|
+
str(floating_ip_num),
|
|
662
402
|
'--fixed-ips',
|
|
663
|
-
str(
|
|
403
|
+
str(fix_ip_num),
|
|
664
404
|
'--injected-files',
|
|
665
|
-
str(
|
|
405
|
+
str(injected_file_num),
|
|
666
406
|
'--injected-file-size',
|
|
667
|
-
str(
|
|
407
|
+
str(injected_file_size_num),
|
|
668
408
|
'--injected-path-size',
|
|
669
|
-
str(
|
|
409
|
+
str(injected_path_size_num),
|
|
670
410
|
'--key-pairs',
|
|
671
|
-
str(
|
|
411
|
+
str(key_pair_num),
|
|
672
412
|
'--cores',
|
|
673
|
-
str(
|
|
413
|
+
str(core_num),
|
|
674
414
|
'--ram',
|
|
675
|
-
str(
|
|
415
|
+
str(ram_num),
|
|
676
416
|
'--instances',
|
|
677
|
-
str(
|
|
417
|
+
str(instance_num),
|
|
678
418
|
'--properties',
|
|
679
|
-
str(
|
|
419
|
+
str(property_num),
|
|
680
420
|
'--secgroup-rules',
|
|
681
|
-
str(
|
|
421
|
+
str(secgroup_rule_num),
|
|
682
422
|
'--secgroups',
|
|
683
|
-
str(
|
|
423
|
+
str(secgroup_num),
|
|
684
424
|
'--server-groups',
|
|
685
|
-
str(
|
|
425
|
+
str(servgroup_num),
|
|
686
426
|
'--server-group-members',
|
|
687
|
-
str(
|
|
427
|
+
str(servgroup_members_num),
|
|
688
428
|
self.projects[0].name,
|
|
689
429
|
]
|
|
690
430
|
verifylist = [
|
|
691
|
-
('floating_ips',
|
|
692
|
-
('fixed_ips',
|
|
693
|
-
('injected_files',
|
|
431
|
+
('floating_ips', floating_ip_num),
|
|
432
|
+
('fixed_ips', fix_ip_num),
|
|
433
|
+
('injected_files', injected_file_num),
|
|
694
434
|
(
|
|
695
435
|
'injected_file_content_bytes',
|
|
696
|
-
|
|
436
|
+
injected_file_size_num,
|
|
697
437
|
),
|
|
698
|
-
('injected_file_path_bytes',
|
|
699
|
-
('key_pairs',
|
|
700
|
-
('cores',
|
|
701
|
-
('ram',
|
|
702
|
-
('instances',
|
|
703
|
-
('metadata_items',
|
|
704
|
-
('security_group_rules',
|
|
705
|
-
('security_groups',
|
|
706
|
-
('server_groups',
|
|
707
|
-
('server_group_members',
|
|
438
|
+
('injected_file_path_bytes', injected_path_size_num),
|
|
439
|
+
('key_pairs', key_pair_num),
|
|
440
|
+
('cores', core_num),
|
|
441
|
+
('ram', ram_num),
|
|
442
|
+
('instances', instance_num),
|
|
443
|
+
('metadata_items', property_num),
|
|
444
|
+
('security_group_rules', secgroup_rule_num),
|
|
445
|
+
('security_groups', secgroup_num),
|
|
446
|
+
('server_groups', servgroup_num),
|
|
447
|
+
('server_group_members', servgroup_members_num),
|
|
448
|
+
('force', False),
|
|
708
449
|
('project', self.projects[0].name),
|
|
709
450
|
]
|
|
710
451
|
self.app.client_manager.network_endpoint_enabled = False
|
|
@@ -713,52 +454,59 @@ class TestQuotaSet(TestQuota):
|
|
|
713
454
|
result = self.cmd.take_action(parsed_args)
|
|
714
455
|
|
|
715
456
|
kwargs = {
|
|
716
|
-
'floating_ips':
|
|
717
|
-
'fixed_ips':
|
|
718
|
-
'injected_files':
|
|
719
|
-
'injected_file_content_bytes':
|
|
720
|
-
'injected_file_path_bytes':
|
|
721
|
-
'key_pairs':
|
|
722
|
-
'cores':
|
|
723
|
-
'ram':
|
|
724
|
-
'instances':
|
|
725
|
-
'metadata_items':
|
|
726
|
-
'security_group_rules':
|
|
727
|
-
'security_groups':
|
|
728
|
-
'server_groups':
|
|
729
|
-
'server_group_members':
|
|
457
|
+
'floating_ips': floating_ip_num,
|
|
458
|
+
'fixed_ips': fix_ip_num,
|
|
459
|
+
'injected_files': injected_file_num,
|
|
460
|
+
'injected_file_content_bytes': injected_file_size_num, # noqa: E501
|
|
461
|
+
'injected_file_path_bytes': injected_path_size_num,
|
|
462
|
+
'key_pairs': key_pair_num,
|
|
463
|
+
'cores': core_num,
|
|
464
|
+
'ram': ram_num,
|
|
465
|
+
'instances': instance_num,
|
|
466
|
+
'metadata_items': property_num,
|
|
467
|
+
'security_group_rules': secgroup_rule_num,
|
|
468
|
+
'security_groups': secgroup_num,
|
|
469
|
+
'server_groups': servgroup_num,
|
|
470
|
+
'server_group_members': servgroup_members_num,
|
|
730
471
|
}
|
|
731
472
|
|
|
732
|
-
self.
|
|
473
|
+
self.compute_sdk_client.update_quota_set.assert_called_once_with(
|
|
733
474
|
self.projects[0].id, **kwargs
|
|
734
475
|
)
|
|
735
476
|
self.assertIsNone(result)
|
|
736
477
|
|
|
737
478
|
def test_quota_set_volume(self):
|
|
479
|
+
gigabytes = 1000
|
|
480
|
+
volumes = 11
|
|
481
|
+
snapshots = 10
|
|
482
|
+
backups = 10
|
|
483
|
+
backup_gigabytes = 1000
|
|
484
|
+
per_volume_gigabytes = -1
|
|
485
|
+
|
|
738
486
|
arglist = [
|
|
739
487
|
'--gigabytes',
|
|
740
|
-
str(
|
|
488
|
+
str(gigabytes),
|
|
741
489
|
'--snapshots',
|
|
742
|
-
str(
|
|
490
|
+
str(snapshots),
|
|
743
491
|
'--volumes',
|
|
744
|
-
str(
|
|
492
|
+
str(volumes),
|
|
745
493
|
'--backups',
|
|
746
|
-
str(
|
|
494
|
+
str(backups),
|
|
747
495
|
'--backup-gigabytes',
|
|
748
|
-
str(
|
|
496
|
+
str(backup_gigabytes),
|
|
749
497
|
'--per-volume-gigabytes',
|
|
750
|
-
str(
|
|
498
|
+
str(per_volume_gigabytes),
|
|
751
499
|
self.projects[0].name,
|
|
752
500
|
]
|
|
753
501
|
verifylist = [
|
|
754
|
-
('gigabytes',
|
|
755
|
-
('snapshots',
|
|
756
|
-
('volumes',
|
|
757
|
-
('backups',
|
|
758
|
-
('backup_gigabytes',
|
|
502
|
+
('gigabytes', gigabytes),
|
|
503
|
+
('snapshots', snapshots),
|
|
504
|
+
('volumes', volumes),
|
|
505
|
+
('backups', backups),
|
|
506
|
+
('backup_gigabytes', backup_gigabytes),
|
|
759
507
|
(
|
|
760
508
|
'per_volume_gigabytes',
|
|
761
|
-
|
|
509
|
+
per_volume_gigabytes,
|
|
762
510
|
),
|
|
763
511
|
('project', self.projects[0].name),
|
|
764
512
|
]
|
|
@@ -767,47 +515,54 @@ class TestQuotaSet(TestQuota):
|
|
|
767
515
|
result = self.cmd.take_action(parsed_args)
|
|
768
516
|
|
|
769
517
|
kwargs = {
|
|
770
|
-
'gigabytes':
|
|
771
|
-
'snapshots':
|
|
772
|
-
'volumes':
|
|
773
|
-
'backups':
|
|
774
|
-
'backup_gigabytes':
|
|
775
|
-
'per_volume_gigabytes':
|
|
518
|
+
'gigabytes': gigabytes,
|
|
519
|
+
'snapshots': snapshots,
|
|
520
|
+
'volumes': volumes,
|
|
521
|
+
'backups': backups,
|
|
522
|
+
'backup_gigabytes': backup_gigabytes,
|
|
523
|
+
'per_volume_gigabytes': per_volume_gigabytes,
|
|
776
524
|
}
|
|
777
525
|
|
|
778
|
-
self.
|
|
526
|
+
self.volume_sdk_client.update_quota_set.assert_called_once_with(
|
|
779
527
|
self.projects[0].id, **kwargs
|
|
780
528
|
)
|
|
781
529
|
|
|
782
530
|
self.assertIsNone(result)
|
|
783
531
|
|
|
784
532
|
def test_quota_set_volume_with_volume_type(self):
|
|
533
|
+
gigabytes = 1000
|
|
534
|
+
volumes = 11
|
|
535
|
+
snapshots = 10
|
|
536
|
+
backups = 10
|
|
537
|
+
backup_gigabytes = 1000
|
|
538
|
+
per_volume_gigabytes = -1
|
|
539
|
+
|
|
785
540
|
arglist = [
|
|
786
541
|
'--gigabytes',
|
|
787
|
-
str(
|
|
542
|
+
str(gigabytes),
|
|
788
543
|
'--snapshots',
|
|
789
|
-
str(
|
|
544
|
+
str(snapshots),
|
|
790
545
|
'--volumes',
|
|
791
|
-
str(
|
|
546
|
+
str(volumes),
|
|
792
547
|
'--backups',
|
|
793
|
-
str(
|
|
548
|
+
str(backups),
|
|
794
549
|
'--backup-gigabytes',
|
|
795
|
-
str(
|
|
550
|
+
str(backup_gigabytes),
|
|
796
551
|
'--per-volume-gigabytes',
|
|
797
|
-
str(
|
|
552
|
+
str(per_volume_gigabytes),
|
|
798
553
|
'--volume-type',
|
|
799
554
|
'volume_type_backend',
|
|
800
555
|
self.projects[0].name,
|
|
801
556
|
]
|
|
802
557
|
verifylist = [
|
|
803
|
-
('gigabytes',
|
|
804
|
-
('snapshots',
|
|
805
|
-
('volumes',
|
|
806
|
-
('backups',
|
|
807
|
-
('backup_gigabytes',
|
|
558
|
+
('gigabytes', gigabytes),
|
|
559
|
+
('snapshots', snapshots),
|
|
560
|
+
('volumes', volumes),
|
|
561
|
+
('backups', backups),
|
|
562
|
+
('backup_gigabytes', backup_gigabytes),
|
|
808
563
|
(
|
|
809
564
|
'per_volume_gigabytes',
|
|
810
|
-
|
|
565
|
+
per_volume_gigabytes,
|
|
811
566
|
),
|
|
812
567
|
('volume_type', 'volume_type_backend'),
|
|
813
568
|
('project', self.projects[0].name),
|
|
@@ -817,69 +572,81 @@ class TestQuotaSet(TestQuota):
|
|
|
817
572
|
result = self.cmd.take_action(parsed_args)
|
|
818
573
|
|
|
819
574
|
kwargs = {
|
|
820
|
-
'gigabytes_volume_type_backend':
|
|
821
|
-
'snapshots_volume_type_backend':
|
|
822
|
-
'volumes_volume_type_backend':
|
|
823
|
-
'backups':
|
|
824
|
-
'backup_gigabytes':
|
|
825
|
-
'per_volume_gigabytes':
|
|
575
|
+
'gigabytes_volume_type_backend': gigabytes,
|
|
576
|
+
'snapshots_volume_type_backend': snapshots,
|
|
577
|
+
'volumes_volume_type_backend': volumes,
|
|
578
|
+
'backups': backups,
|
|
579
|
+
'backup_gigabytes': backup_gigabytes,
|
|
580
|
+
'per_volume_gigabytes': per_volume_gigabytes,
|
|
826
581
|
}
|
|
827
582
|
|
|
828
|
-
self.
|
|
583
|
+
self.volume_sdk_client.update_quota_set.assert_called_once_with(
|
|
829
584
|
self.projects[0].id, **kwargs
|
|
830
585
|
)
|
|
831
586
|
self.assertIsNone(result)
|
|
832
587
|
|
|
833
588
|
def test_quota_set_network(self):
|
|
589
|
+
subnet = 10
|
|
590
|
+
network = 10
|
|
591
|
+
floatingip = 50
|
|
592
|
+
subnetpool = -1
|
|
593
|
+
security_group_rule = 100
|
|
594
|
+
security_group = 10
|
|
595
|
+
router = 10
|
|
596
|
+
rbac_policy = -1
|
|
597
|
+
port = 50
|
|
598
|
+
|
|
834
599
|
arglist = [
|
|
835
600
|
'--subnets',
|
|
836
|
-
str(
|
|
601
|
+
str(subnet),
|
|
837
602
|
'--networks',
|
|
838
|
-
str(
|
|
603
|
+
str(network),
|
|
839
604
|
'--floating-ips',
|
|
840
|
-
str(
|
|
605
|
+
str(floatingip),
|
|
841
606
|
'--subnetpools',
|
|
842
|
-
str(
|
|
607
|
+
str(subnetpool),
|
|
843
608
|
'--secgroup-rules',
|
|
844
|
-
str(
|
|
609
|
+
str(security_group_rule),
|
|
845
610
|
'--secgroups',
|
|
846
|
-
str(
|
|
611
|
+
str(security_group),
|
|
847
612
|
'--routers',
|
|
848
|
-
str(
|
|
613
|
+
str(router),
|
|
849
614
|
'--rbac-policies',
|
|
850
|
-
str(
|
|
615
|
+
str(rbac_policy),
|
|
851
616
|
'--ports',
|
|
852
|
-
str(
|
|
617
|
+
str(port),
|
|
853
618
|
self.projects[0].name,
|
|
854
619
|
]
|
|
855
620
|
verifylist = [
|
|
856
|
-
('subnet',
|
|
857
|
-
('network',
|
|
858
|
-
('floatingip',
|
|
859
|
-
('subnetpool',
|
|
621
|
+
('subnet', subnet),
|
|
622
|
+
('network', network),
|
|
623
|
+
('floatingip', floatingip),
|
|
624
|
+
('subnetpool', subnetpool),
|
|
860
625
|
(
|
|
861
626
|
'security_group_rule',
|
|
862
|
-
|
|
627
|
+
security_group_rule,
|
|
863
628
|
),
|
|
864
|
-
('security_group',
|
|
865
|
-
('router',
|
|
866
|
-
('rbac_policy',
|
|
867
|
-
('port',
|
|
629
|
+
('security_group', security_group),
|
|
630
|
+
('router', router),
|
|
631
|
+
('rbac_policy', rbac_policy),
|
|
632
|
+
('port', port),
|
|
633
|
+
('force', False),
|
|
868
634
|
('project', self.projects[0].name),
|
|
869
635
|
]
|
|
870
636
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
871
637
|
|
|
872
638
|
result = self.cmd.take_action(parsed_args)
|
|
873
639
|
kwargs = {
|
|
874
|
-
'
|
|
875
|
-
'
|
|
876
|
-
'
|
|
877
|
-
'
|
|
878
|
-
'
|
|
879
|
-
'
|
|
880
|
-
'
|
|
881
|
-
'
|
|
882
|
-
'
|
|
640
|
+
'check_limit': True,
|
|
641
|
+
'subnet': subnet,
|
|
642
|
+
'network': network,
|
|
643
|
+
'floatingip': floatingip,
|
|
644
|
+
'subnetpool': subnetpool,
|
|
645
|
+
'security_group_rule': security_group_rule,
|
|
646
|
+
'security_group': security_group,
|
|
647
|
+
'router': router,
|
|
648
|
+
'rbac_policy': rbac_policy,
|
|
649
|
+
'port': port,
|
|
883
650
|
}
|
|
884
651
|
self.network_client.update_quota.assert_called_once_with(
|
|
885
652
|
self.projects[0].id, **kwargs
|
|
@@ -887,56 +654,71 @@ class TestQuotaSet(TestQuota):
|
|
|
887
654
|
self.assertIsNone(result)
|
|
888
655
|
|
|
889
656
|
def test_quota_set_with_class(self):
|
|
657
|
+
floating_ip_num = 100
|
|
658
|
+
fix_ip_num = 100
|
|
659
|
+
injected_file_num = 100
|
|
660
|
+
injected_file_size_num = 10240
|
|
661
|
+
injected_path_size_num = 255
|
|
662
|
+
key_pair_num = 100
|
|
663
|
+
core_num = 20
|
|
664
|
+
ram_num = 51200
|
|
665
|
+
instance_num = 10
|
|
666
|
+
property_num = 128
|
|
667
|
+
servgroup_num = 10
|
|
668
|
+
servgroup_members_num = 10
|
|
669
|
+
volumes = 11
|
|
670
|
+
network = 10
|
|
671
|
+
|
|
890
672
|
arglist = [
|
|
891
673
|
'--injected-files',
|
|
892
|
-
str(
|
|
674
|
+
str(injected_file_num),
|
|
893
675
|
'--injected-file-size',
|
|
894
|
-
str(
|
|
676
|
+
str(injected_file_size_num),
|
|
895
677
|
'--injected-path-size',
|
|
896
|
-
str(
|
|
678
|
+
str(injected_path_size_num),
|
|
897
679
|
'--key-pairs',
|
|
898
|
-
str(
|
|
680
|
+
str(key_pair_num),
|
|
899
681
|
'--cores',
|
|
900
|
-
str(
|
|
682
|
+
str(core_num),
|
|
901
683
|
'--ram',
|
|
902
|
-
str(
|
|
684
|
+
str(ram_num),
|
|
903
685
|
'--instances',
|
|
904
|
-
str(
|
|
686
|
+
str(instance_num),
|
|
905
687
|
'--properties',
|
|
906
|
-
str(
|
|
688
|
+
str(property_num),
|
|
907
689
|
'--server-groups',
|
|
908
|
-
str(
|
|
690
|
+
str(servgroup_num),
|
|
909
691
|
'--server-group-members',
|
|
910
|
-
str(
|
|
692
|
+
str(servgroup_members_num),
|
|
911
693
|
'--gigabytes',
|
|
912
|
-
str(
|
|
694
|
+
str(floating_ip_num),
|
|
913
695
|
'--snapshots',
|
|
914
|
-
str(
|
|
696
|
+
str(fix_ip_num),
|
|
915
697
|
'--volumes',
|
|
916
|
-
str(
|
|
698
|
+
str(volumes),
|
|
917
699
|
'--network',
|
|
918
|
-
str(
|
|
700
|
+
str(network),
|
|
919
701
|
'--class',
|
|
920
702
|
self.projects[0].name,
|
|
921
703
|
]
|
|
922
704
|
verifylist = [
|
|
923
|
-
('injected_files',
|
|
705
|
+
('injected_files', injected_file_num),
|
|
924
706
|
(
|
|
925
707
|
'injected_file_content_bytes',
|
|
926
|
-
|
|
708
|
+
injected_file_size_num,
|
|
927
709
|
),
|
|
928
|
-
('injected_file_path_bytes',
|
|
929
|
-
('key_pairs',
|
|
930
|
-
('cores',
|
|
931
|
-
('ram',
|
|
932
|
-
('instances',
|
|
933
|
-
('metadata_items',
|
|
934
|
-
('server_groups',
|
|
935
|
-
('server_group_members',
|
|
936
|
-
('gigabytes',
|
|
937
|
-
('snapshots',
|
|
938
|
-
('volumes',
|
|
939
|
-
('network',
|
|
710
|
+
('injected_file_path_bytes', injected_path_size_num),
|
|
711
|
+
('key_pairs', key_pair_num),
|
|
712
|
+
('cores', core_num),
|
|
713
|
+
('ram', ram_num),
|
|
714
|
+
('instances', instance_num),
|
|
715
|
+
('metadata_items', property_num),
|
|
716
|
+
('server_groups', servgroup_num),
|
|
717
|
+
('server_group_members', servgroup_members_num),
|
|
718
|
+
('gigabytes', floating_ip_num),
|
|
719
|
+
('snapshots', fix_ip_num),
|
|
720
|
+
('volumes', volumes),
|
|
721
|
+
('network', network),
|
|
940
722
|
('quota_class', True),
|
|
941
723
|
('project', self.projects[0].name),
|
|
942
724
|
]
|
|
@@ -945,53 +727,157 @@ class TestQuotaSet(TestQuota):
|
|
|
945
727
|
result = self.cmd.take_action(parsed_args)
|
|
946
728
|
|
|
947
729
|
kwargs_compute = {
|
|
948
|
-
'injected_files':
|
|
949
|
-
'injected_file_content_bytes':
|
|
950
|
-
'injected_file_path_bytes':
|
|
951
|
-
'key_pairs':
|
|
952
|
-
'cores':
|
|
953
|
-
'ram':
|
|
954
|
-
'instances':
|
|
955
|
-
'metadata_items':
|
|
956
|
-
'server_groups':
|
|
957
|
-
'server_group_members':
|
|
730
|
+
'injected_files': injected_file_num,
|
|
731
|
+
'injected_file_content_bytes': injected_file_size_num, # noqa: E501
|
|
732
|
+
'injected_file_path_bytes': injected_path_size_num,
|
|
733
|
+
'key_pairs': key_pair_num,
|
|
734
|
+
'cores': core_num,
|
|
735
|
+
'ram': ram_num,
|
|
736
|
+
'instances': instance_num,
|
|
737
|
+
'metadata_items': property_num,
|
|
738
|
+
'server_groups': servgroup_num,
|
|
739
|
+
'server_group_members': servgroup_members_num,
|
|
958
740
|
}
|
|
959
741
|
kwargs_volume = {
|
|
960
|
-
'gigabytes':
|
|
961
|
-
'snapshots':
|
|
962
|
-
'volumes':
|
|
742
|
+
'gigabytes': floating_ip_num,
|
|
743
|
+
'snapshots': fix_ip_num,
|
|
744
|
+
'volumes': volumes,
|
|
963
745
|
}
|
|
964
746
|
|
|
965
|
-
self.
|
|
747
|
+
self.compute_sdk_client.update_quota_class_set.assert_called_with(
|
|
966
748
|
self.projects[0].name, **kwargs_compute
|
|
967
749
|
)
|
|
968
|
-
self.
|
|
750
|
+
self.volume_sdk_client.update_quota_class_set.assert_called_with(
|
|
969
751
|
self.projects[0].name, **kwargs_volume
|
|
970
752
|
)
|
|
971
753
|
self.assertNotCalled(self.network_client.update_quota)
|
|
972
754
|
self.assertIsNone(result)
|
|
973
755
|
|
|
756
|
+
def test_quota_set_default(self):
|
|
757
|
+
floating_ip_num = 100
|
|
758
|
+
fix_ip_num = 100
|
|
759
|
+
injected_file_num = 100
|
|
760
|
+
injected_file_size_num = 10240
|
|
761
|
+
injected_path_size_num = 255
|
|
762
|
+
key_pair_num = 100
|
|
763
|
+
core_num = 20
|
|
764
|
+
ram_num = 51200
|
|
765
|
+
instance_num = 10
|
|
766
|
+
property_num = 128
|
|
767
|
+
servgroup_num = 10
|
|
768
|
+
servgroup_members_num = 10
|
|
769
|
+
volumes = 11
|
|
770
|
+
network = 10
|
|
771
|
+
|
|
772
|
+
arglist = [
|
|
773
|
+
'--injected-files',
|
|
774
|
+
str(injected_file_num),
|
|
775
|
+
'--injected-file-size',
|
|
776
|
+
str(injected_file_size_num),
|
|
777
|
+
'--injected-path-size',
|
|
778
|
+
str(injected_path_size_num),
|
|
779
|
+
'--key-pairs',
|
|
780
|
+
str(key_pair_num),
|
|
781
|
+
'--cores',
|
|
782
|
+
str(core_num),
|
|
783
|
+
'--ram',
|
|
784
|
+
str(ram_num),
|
|
785
|
+
'--instances',
|
|
786
|
+
str(instance_num),
|
|
787
|
+
'--properties',
|
|
788
|
+
str(property_num),
|
|
789
|
+
'--server-groups',
|
|
790
|
+
str(servgroup_num),
|
|
791
|
+
'--server-group-members',
|
|
792
|
+
str(servgroup_members_num),
|
|
793
|
+
'--gigabytes',
|
|
794
|
+
str(floating_ip_num),
|
|
795
|
+
'--snapshots',
|
|
796
|
+
str(fix_ip_num),
|
|
797
|
+
'--volumes',
|
|
798
|
+
str(volumes),
|
|
799
|
+
'--network',
|
|
800
|
+
str(network),
|
|
801
|
+
'--default',
|
|
802
|
+
]
|
|
803
|
+
verifylist = [
|
|
804
|
+
('injected_files', injected_file_num),
|
|
805
|
+
(
|
|
806
|
+
'injected_file_content_bytes',
|
|
807
|
+
injected_file_size_num,
|
|
808
|
+
),
|
|
809
|
+
('injected_file_path_bytes', injected_path_size_num),
|
|
810
|
+
('key_pairs', key_pair_num),
|
|
811
|
+
('cores', core_num),
|
|
812
|
+
('ram', ram_num),
|
|
813
|
+
('instances', instance_num),
|
|
814
|
+
('metadata_items', property_num),
|
|
815
|
+
('server_groups', servgroup_num),
|
|
816
|
+
('server_group_members', servgroup_members_num),
|
|
817
|
+
('gigabytes', floating_ip_num),
|
|
818
|
+
('snapshots', fix_ip_num),
|
|
819
|
+
('volumes', volumes),
|
|
820
|
+
('network', network),
|
|
821
|
+
('default', True),
|
|
822
|
+
]
|
|
823
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
824
|
+
|
|
825
|
+
result = self.cmd.take_action(parsed_args)
|
|
826
|
+
|
|
827
|
+
kwargs_compute = {
|
|
828
|
+
'injected_files': injected_file_num,
|
|
829
|
+
'injected_file_content_bytes': injected_file_size_num, # noqa: E501
|
|
830
|
+
'injected_file_path_bytes': injected_path_size_num,
|
|
831
|
+
'key_pairs': key_pair_num,
|
|
832
|
+
'cores': core_num,
|
|
833
|
+
'ram': ram_num,
|
|
834
|
+
'instances': instance_num,
|
|
835
|
+
'metadata_items': property_num,
|
|
836
|
+
'server_groups': servgroup_num,
|
|
837
|
+
'server_group_members': servgroup_members_num,
|
|
838
|
+
}
|
|
839
|
+
kwargs_volume = {
|
|
840
|
+
'gigabytes': floating_ip_num,
|
|
841
|
+
'snapshots': fix_ip_num,
|
|
842
|
+
'volumes': volumes,
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
self.compute_sdk_client.update_quota_class_set.assert_called_with(
|
|
846
|
+
'default', **kwargs_compute
|
|
847
|
+
)
|
|
848
|
+
self.volume_sdk_client.update_quota_class_set.assert_called_with(
|
|
849
|
+
'default', **kwargs_volume
|
|
850
|
+
)
|
|
851
|
+
self.assertNotCalled(self.network_client.update_quota)
|
|
852
|
+
self.assertIsNone(result)
|
|
853
|
+
|
|
974
854
|
def test_quota_set_with_force(self):
|
|
855
|
+
core_num = 20
|
|
856
|
+
ram_num = 51200
|
|
857
|
+
instance_num = 10
|
|
858
|
+
volumes = 11
|
|
859
|
+
subnet = 10
|
|
860
|
+
|
|
975
861
|
arglist = [
|
|
976
862
|
'--cores',
|
|
977
|
-
str(
|
|
863
|
+
str(core_num),
|
|
978
864
|
'--ram',
|
|
979
|
-
str(
|
|
865
|
+
str(ram_num),
|
|
980
866
|
'--instances',
|
|
981
|
-
str(
|
|
867
|
+
str(instance_num),
|
|
982
868
|
'--volumes',
|
|
983
|
-
str(
|
|
869
|
+
str(volumes),
|
|
984
870
|
'--subnets',
|
|
985
|
-
str(
|
|
871
|
+
str(subnet),
|
|
986
872
|
'--force',
|
|
987
873
|
self.projects[0].name,
|
|
988
874
|
]
|
|
989
875
|
verifylist = [
|
|
990
|
-
('cores',
|
|
991
|
-
('ram',
|
|
992
|
-
('instances',
|
|
993
|
-
('volumes',
|
|
994
|
-
('subnet',
|
|
876
|
+
('cores', core_num),
|
|
877
|
+
('ram', ram_num),
|
|
878
|
+
('instances', instance_num),
|
|
879
|
+
('volumes', volumes),
|
|
880
|
+
('subnet', subnet),
|
|
995
881
|
('force', True),
|
|
996
882
|
('project', self.projects[0].name),
|
|
997
883
|
]
|
|
@@ -1001,22 +887,22 @@ class TestQuotaSet(TestQuota):
|
|
|
1001
887
|
result = self.cmd.take_action(parsed_args)
|
|
1002
888
|
|
|
1003
889
|
kwargs_compute = {
|
|
1004
|
-
'cores':
|
|
1005
|
-
'ram':
|
|
1006
|
-
'instances':
|
|
890
|
+
'cores': core_num,
|
|
891
|
+
'ram': ram_num,
|
|
892
|
+
'instances': instance_num,
|
|
1007
893
|
'force': True,
|
|
1008
894
|
}
|
|
1009
895
|
kwargs_volume = {
|
|
1010
|
-
'volumes':
|
|
896
|
+
'volumes': volumes,
|
|
1011
897
|
}
|
|
1012
898
|
kwargs_network = {
|
|
1013
|
-
'subnet':
|
|
899
|
+
'subnet': subnet,
|
|
1014
900
|
'force': True,
|
|
1015
901
|
}
|
|
1016
|
-
self.
|
|
902
|
+
self.compute_sdk_client.update_quota_set.assert_called_once_with(
|
|
1017
903
|
self.projects[0].id, **kwargs_compute
|
|
1018
904
|
)
|
|
1019
|
-
self.
|
|
905
|
+
self.volume_sdk_client.update_quota_set.assert_called_once_with(
|
|
1020
906
|
self.projects[0].id, **kwargs_volume
|
|
1021
907
|
)
|
|
1022
908
|
self.network_client.update_quota.assert_called_once_with(
|
|
@@ -1027,18 +913,18 @@ class TestQuotaSet(TestQuota):
|
|
|
1027
913
|
def test_quota_set_with_no_force(self):
|
|
1028
914
|
arglist = [
|
|
1029
915
|
'--subnets',
|
|
1030
|
-
str(
|
|
916
|
+
str(10),
|
|
1031
917
|
'--volumes',
|
|
1032
|
-
str(
|
|
918
|
+
str(30),
|
|
1033
919
|
'--cores',
|
|
1034
|
-
str(
|
|
920
|
+
str(20),
|
|
1035
921
|
'--no-force',
|
|
1036
922
|
self.projects[0].name,
|
|
1037
923
|
]
|
|
1038
924
|
verifylist = [
|
|
1039
|
-
('subnet',
|
|
1040
|
-
('volumes',
|
|
1041
|
-
('cores',
|
|
925
|
+
('subnet', 10),
|
|
926
|
+
('volumes', 30),
|
|
927
|
+
('cores', 20),
|
|
1042
928
|
('force', False),
|
|
1043
929
|
('project', self.projects[0].name),
|
|
1044
930
|
]
|
|
@@ -1047,20 +933,19 @@ class TestQuotaSet(TestQuota):
|
|
|
1047
933
|
result = self.cmd.take_action(parsed_args)
|
|
1048
934
|
|
|
1049
935
|
kwargs_compute = {
|
|
1050
|
-
'cores':
|
|
1051
|
-
'force': False,
|
|
936
|
+
'cores': 20,
|
|
1052
937
|
}
|
|
1053
938
|
kwargs_volume = {
|
|
1054
|
-
'volumes':
|
|
939
|
+
'volumes': 30,
|
|
1055
940
|
}
|
|
1056
941
|
kwargs_network = {
|
|
1057
|
-
'subnet':
|
|
942
|
+
'subnet': 10,
|
|
1058
943
|
'check_limit': True,
|
|
1059
944
|
}
|
|
1060
|
-
self.
|
|
945
|
+
self.compute_sdk_client.update_quota_set.assert_called_once_with(
|
|
1061
946
|
self.projects[0].id, **kwargs_compute
|
|
1062
947
|
)
|
|
1063
|
-
self.
|
|
948
|
+
self.volume_sdk_client.update_quota_set.assert_called_once_with(
|
|
1064
949
|
self.projects[0].id, **kwargs_volume
|
|
1065
950
|
)
|
|
1066
951
|
self.network_client.update_quota.assert_called_once_with(
|
|
@@ -1073,47 +958,36 @@ class TestQuotaShow(TestQuota):
|
|
|
1073
958
|
def setUp(self):
|
|
1074
959
|
super().setUp()
|
|
1075
960
|
|
|
1076
|
-
self.
|
|
1077
|
-
|
|
1078
|
-
self.
|
|
1079
|
-
|
|
961
|
+
self.identity_sdk_client.find_project.return_value = self.projects[0]
|
|
962
|
+
|
|
963
|
+
self.compute_sdk_client.get_quota_set.return_value = (
|
|
964
|
+
sdk_fakes.generate_fake_resource(_compute_quota_set.QuotaSet)
|
|
1080
965
|
)
|
|
1081
|
-
self.
|
|
1082
|
-
|
|
966
|
+
self.default_compute_quotas = sdk_fakes.generate_fake_resource(
|
|
967
|
+
_compute_quota_set.QuotaSet
|
|
1083
968
|
)
|
|
1084
|
-
self.
|
|
1085
|
-
|
|
1086
|
-
copy.deepcopy(compute_fakes.QUOTA),
|
|
1087
|
-
loaded=True,
|
|
969
|
+
self.compute_sdk_client.get_quota_set_defaults.return_value = (
|
|
970
|
+
self.default_compute_quotas
|
|
1088
971
|
)
|
|
1089
972
|
|
|
1090
|
-
self.
|
|
1091
|
-
|
|
1092
|
-
self.volume_default_quota = volume_fakes.create_one_default_vol_quota()
|
|
1093
|
-
self.volume_quotas_mock.defaults.return_value = (
|
|
1094
|
-
self.volume_default_quota
|
|
973
|
+
self.volume_sdk_client.get_quota_set.return_value = (
|
|
974
|
+
sdk_fakes.generate_fake_resource(_volume_quota_set.QuotaSet)
|
|
1095
975
|
)
|
|
1096
|
-
self.
|
|
1097
|
-
|
|
1098
|
-
copy.deepcopy(volume_fakes.QUOTA),
|
|
1099
|
-
loaded=True,
|
|
976
|
+
self.default_volume_quotas = sdk_fakes.generate_fake_resource(
|
|
977
|
+
_volume_quota_set.QuotaSet
|
|
1100
978
|
)
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
None,
|
|
1104
|
-
copy.deepcopy(identity_fakes.ENDPOINT),
|
|
1105
|
-
loaded=True,
|
|
979
|
+
self.volume_sdk_client.get_quota_set_defaults.return_value = (
|
|
980
|
+
self.default_volume_quotas
|
|
1106
981
|
)
|
|
1107
982
|
|
|
1108
|
-
self.
|
|
1109
|
-
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
self.network_client.get_quota = mock.Mock(
|
|
1113
|
-
return_value=network_fakes.QUOTA,
|
|
983
|
+
self.network_client.get_quota.return_value = (
|
|
984
|
+
sdk_fakes.generate_fake_resource(_network_quota_set.Quota)
|
|
1114
985
|
)
|
|
1115
|
-
self.
|
|
1116
|
-
|
|
986
|
+
self.default_network_quotas = sdk_fakes.generate_fake_resource(
|
|
987
|
+
_network_quota_set.QuotaDefault
|
|
988
|
+
)
|
|
989
|
+
self.network_client.get_quota_default.return_value = (
|
|
990
|
+
self.default_network_quotas
|
|
1117
991
|
)
|
|
1118
992
|
|
|
1119
993
|
self.cmd = quota.ShowQuota(self.app, None)
|
|
@@ -1130,11 +1004,11 @@ class TestQuotaShow(TestQuota):
|
|
|
1130
1004
|
|
|
1131
1005
|
self.cmd.take_action(parsed_args)
|
|
1132
1006
|
|
|
1133
|
-
self.
|
|
1007
|
+
self.compute_sdk_client.get_quota_set.assert_called_once_with(
|
|
1134
1008
|
self.projects[0].id,
|
|
1135
|
-
|
|
1009
|
+
usage=False,
|
|
1136
1010
|
)
|
|
1137
|
-
self.
|
|
1011
|
+
self.volume_sdk_client.get_quota_set.assert_called_once_with(
|
|
1138
1012
|
self.projects[0].id,
|
|
1139
1013
|
usage=False,
|
|
1140
1014
|
)
|
|
@@ -1157,11 +1031,11 @@ class TestQuotaShow(TestQuota):
|
|
|
1157
1031
|
|
|
1158
1032
|
self.cmd.take_action(parsed_args)
|
|
1159
1033
|
|
|
1160
|
-
self.
|
|
1034
|
+
self.compute_sdk_client.get_quota_set.assert_called_once_with(
|
|
1161
1035
|
self.projects[0].id,
|
|
1162
|
-
|
|
1036
|
+
usage=False,
|
|
1163
1037
|
)
|
|
1164
|
-
self.
|
|
1038
|
+
self.volume_sdk_client.get_quota_set.assert_not_called()
|
|
1165
1039
|
self.network_client.get_quota.assert_not_called()
|
|
1166
1040
|
|
|
1167
1041
|
def test_quota_show__with_volume(self):
|
|
@@ -1177,8 +1051,8 @@ class TestQuotaShow(TestQuota):
|
|
|
1177
1051
|
|
|
1178
1052
|
self.cmd.take_action(parsed_args)
|
|
1179
1053
|
|
|
1180
|
-
self.
|
|
1181
|
-
self.
|
|
1054
|
+
self.compute_sdk_client.get_quota_set.assert_not_called()
|
|
1055
|
+
self.volume_sdk_client.get_quota_set.assert_called_once_with(
|
|
1182
1056
|
self.projects[0].id,
|
|
1183
1057
|
usage=False,
|
|
1184
1058
|
)
|
|
@@ -1197,8 +1071,8 @@ class TestQuotaShow(TestQuota):
|
|
|
1197
1071
|
|
|
1198
1072
|
self.cmd.take_action(parsed_args)
|
|
1199
1073
|
|
|
1200
|
-
self.
|
|
1201
|
-
self.
|
|
1074
|
+
self.compute_sdk_client.get_quota_set.assert_not_called()
|
|
1075
|
+
self.volume_sdk_client.get_quota_set.assert_not_called()
|
|
1202
1076
|
self.network_client.get_quota.assert_called_once_with(
|
|
1203
1077
|
self.projects[0].id,
|
|
1204
1078
|
details=False,
|
|
@@ -1218,10 +1092,10 @@ class TestQuotaShow(TestQuota):
|
|
|
1218
1092
|
|
|
1219
1093
|
self.cmd.take_action(parsed_args)
|
|
1220
1094
|
|
|
1221
|
-
self.
|
|
1095
|
+
self.compute_sdk_client.get_quota_set_defaults.assert_called_once_with(
|
|
1222
1096
|
self.projects[0].id,
|
|
1223
1097
|
)
|
|
1224
|
-
self.
|
|
1098
|
+
self.volume_sdk_client.get_quota_set_defaults.assert_called_once_with(
|
|
1225
1099
|
self.projects[0].id,
|
|
1226
1100
|
)
|
|
1227
1101
|
self.network_client.get_quota_default.assert_called_once_with(
|
|
@@ -1229,35 +1103,7 @@ class TestQuotaShow(TestQuota):
|
|
|
1229
1103
|
)
|
|
1230
1104
|
self.assertNotCalled(self.network_client.get_quota)
|
|
1231
1105
|
|
|
1232
|
-
def test_quota_show__with_class(self):
|
|
1233
|
-
arglist = [
|
|
1234
|
-
'--class',
|
|
1235
|
-
'default',
|
|
1236
|
-
]
|
|
1237
|
-
verifylist = [
|
|
1238
|
-
('quota_class', True),
|
|
1239
|
-
('project', 'default'), # project is actually a class here
|
|
1240
|
-
]
|
|
1241
|
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1242
|
-
|
|
1243
|
-
self.cmd.take_action(parsed_args)
|
|
1244
|
-
|
|
1245
|
-
self.compute_quotas_class_mock.get.assert_called_once_with('default')
|
|
1246
|
-
self.volume_quotas_class_mock.get.assert_called_once_with('default')
|
|
1247
|
-
# neutron doesn't have the concept of quota classes
|
|
1248
|
-
self.assertNotCalled(self.network_client.get_quota)
|
|
1249
|
-
self.assertNotCalled(self.network_client.get_quota_default)
|
|
1250
|
-
|
|
1251
1106
|
def test_quota_show__with_usage(self):
|
|
1252
|
-
# update mocks to return detailed quota instead
|
|
1253
|
-
self.compute_quota = compute_fakes.create_one_comp_detailed_quota()
|
|
1254
|
-
self.compute_quotas_mock.get.return_value = self.compute_quota
|
|
1255
|
-
self.volume_quota = volume_fakes.create_one_detailed_quota()
|
|
1256
|
-
self.volume_quotas_mock.get.return_value = self.volume_quota
|
|
1257
|
-
self.network_client.get_quota.return_value = (
|
|
1258
|
-
network_fakes.FakeQuota.create_one_net_detailed_quota()
|
|
1259
|
-
)
|
|
1260
|
-
|
|
1261
1107
|
arglist = [
|
|
1262
1108
|
'--usage',
|
|
1263
1109
|
self.projects[0].name,
|
|
@@ -1270,11 +1116,11 @@ class TestQuotaShow(TestQuota):
|
|
|
1270
1116
|
|
|
1271
1117
|
self.cmd.take_action(parsed_args)
|
|
1272
1118
|
|
|
1273
|
-
self.
|
|
1119
|
+
self.compute_sdk_client.get_quota_set.assert_called_once_with(
|
|
1274
1120
|
self.projects[0].id,
|
|
1275
|
-
|
|
1121
|
+
usage=True,
|
|
1276
1122
|
)
|
|
1277
|
-
self.
|
|
1123
|
+
self.volume_sdk_client.get_quota_set.assert_called_once_with(
|
|
1278
1124
|
self.projects[0].id,
|
|
1279
1125
|
usage=True,
|
|
1280
1126
|
)
|
|
@@ -1292,14 +1138,14 @@ class TestQuotaShow(TestQuota):
|
|
|
1292
1138
|
|
|
1293
1139
|
self.cmd.take_action(parsed_args)
|
|
1294
1140
|
|
|
1295
|
-
self.
|
|
1296
|
-
|
|
1141
|
+
self.compute_sdk_client.get_quota_set.assert_called_once_with(
|
|
1142
|
+
self.projects[1].id, usage=False
|
|
1297
1143
|
)
|
|
1298
|
-
self.
|
|
1299
|
-
|
|
1144
|
+
self.volume_sdk_client.get_quota_set.assert_called_once_with(
|
|
1145
|
+
self.projects[1].id, usage=False
|
|
1300
1146
|
)
|
|
1301
1147
|
self.network_client.get_quota.assert_called_once_with(
|
|
1302
|
-
|
|
1148
|
+
self.projects[1].id, details=False
|
|
1303
1149
|
)
|
|
1304
1150
|
self.assertNotCalled(self.network_client.get_quota_default)
|
|
1305
1151
|
|
|
@@ -1310,6 +1156,12 @@ class TestQuotaDelete(TestQuota):
|
|
|
1310
1156
|
def setUp(self):
|
|
1311
1157
|
super().setUp()
|
|
1312
1158
|
|
|
1159
|
+
self.identity_sdk_client.find_project.return_value = self.projects[0]
|
|
1160
|
+
|
|
1161
|
+
self.compute_sdk_client.revert_quota_set.return_value = None
|
|
1162
|
+
self.volume_sdk_client.revert_quota_set.return_value = None
|
|
1163
|
+
self.network_client.delete_quota.return_value = None
|
|
1164
|
+
|
|
1313
1165
|
self.cmd = quota.DeleteQuota(self.app, None)
|
|
1314
1166
|
|
|
1315
1167
|
def test_delete(self):
|
|
@@ -1327,11 +1179,13 @@ class TestQuotaDelete(TestQuota):
|
|
|
1327
1179
|
result = self.cmd.take_action(parsed_args)
|
|
1328
1180
|
|
|
1329
1181
|
self.assertIsNone(result)
|
|
1330
|
-
self.
|
|
1331
|
-
|
|
1182
|
+
self.identity_sdk_client.find_project.assert_called_once_with(
|
|
1183
|
+
self.projects[0].id, ignore_missing=False
|
|
1184
|
+
)
|
|
1185
|
+
self.compute_sdk_client.revert_quota_set.assert_called_once_with(
|
|
1332
1186
|
self.projects[0].id,
|
|
1333
1187
|
)
|
|
1334
|
-
self.
|
|
1188
|
+
self.volume_sdk_client.revert_quota_set.assert_called_once_with(
|
|
1335
1189
|
self.projects[0].id,
|
|
1336
1190
|
)
|
|
1337
1191
|
self.network_client.delete_quota.assert_called_once_with(
|
|
@@ -1354,11 +1208,13 @@ class TestQuotaDelete(TestQuota):
|
|
|
1354
1208
|
result = self.cmd.take_action(parsed_args)
|
|
1355
1209
|
|
|
1356
1210
|
self.assertIsNone(result)
|
|
1357
|
-
self.
|
|
1358
|
-
|
|
1211
|
+
self.identity_sdk_client.find_project.assert_called_once_with(
|
|
1212
|
+
self.projects[0].id, ignore_missing=False
|
|
1213
|
+
)
|
|
1214
|
+
self.compute_sdk_client.revert_quota_set.assert_called_once_with(
|
|
1359
1215
|
self.projects[0].id,
|
|
1360
1216
|
)
|
|
1361
|
-
self.
|
|
1217
|
+
self.volume_sdk_client.revert_quota_set.assert_not_called()
|
|
1362
1218
|
self.network_client.delete_quota.assert_not_called()
|
|
1363
1219
|
|
|
1364
1220
|
def test_delete__volume(self):
|
|
@@ -1377,9 +1233,11 @@ class TestQuotaDelete(TestQuota):
|
|
|
1377
1233
|
result = self.cmd.take_action(parsed_args)
|
|
1378
1234
|
|
|
1379
1235
|
self.assertIsNone(result)
|
|
1380
|
-
self.
|
|
1381
|
-
|
|
1382
|
-
|
|
1236
|
+
self.identity_sdk_client.find_project.assert_called_once_with(
|
|
1237
|
+
self.projects[0].id, ignore_missing=False
|
|
1238
|
+
)
|
|
1239
|
+
self.compute_sdk_client.revert_quota_set.assert_not_called()
|
|
1240
|
+
self.volume_sdk_client.revert_quota_set.assert_called_once_with(
|
|
1383
1241
|
self.projects[0].id,
|
|
1384
1242
|
)
|
|
1385
1243
|
self.network_client.delete_quota.assert_not_called()
|
|
@@ -1400,9 +1258,11 @@ class TestQuotaDelete(TestQuota):
|
|
|
1400
1258
|
result = self.cmd.take_action(parsed_args)
|
|
1401
1259
|
|
|
1402
1260
|
self.assertIsNone(result)
|
|
1403
|
-
self.
|
|
1404
|
-
|
|
1405
|
-
|
|
1261
|
+
self.identity_sdk_client.find_project.assert_called_once_with(
|
|
1262
|
+
self.projects[0].id, ignore_missing=False
|
|
1263
|
+
)
|
|
1264
|
+
self.compute_sdk_client.revert_quota_set.assert_not_called()
|
|
1265
|
+
self.volume_sdk_client.revert_quota_set.assert_not_called()
|
|
1406
1266
|
self.network_client.delete_quota.assert_called_once_with(
|
|
1407
1267
|
self.projects[0].id,
|
|
1408
1268
|
)
|