python-openstackclient 6.6.0__py3-none-any.whl → 7.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openstackclient/api/api.py +7 -8
- 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 +16 -4
- openstackclient/common/configuration.py +1 -1
- openstackclient/common/extension.py +1 -1
- openstackclient/common/limits.py +66 -32
- openstackclient/common/module.py +3 -3
- openstackclient/common/progressbar.py +2 -2
- openstackclient/common/project_cleanup.py +5 -2
- openstackclient/common/quota.py +281 -410
- openstackclient/common/versions.py +1 -1
- openstackclient/compute/client.py +7 -116
- openstackclient/compute/v2/agent.py +75 -49
- openstackclient/compute/v2/aggregate.py +9 -9
- 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 +4 -3
- openstackclient/compute/v2/keypair.py +7 -8
- openstackclient/compute/v2/server.py +478 -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 +127 -45
- 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/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 +14 -6
- openstackclient/tests/functional/identity/v3/test_application_credential.py +13 -19
- 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_limit.py +2 -2
- openstackclient/tests/functional/identity/v3/test_region.py +1 -3
- openstackclient/tests/functional/identity/v3/test_registered_limit.py +1 -1
- 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 +4 -6
- 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 +18 -16
- 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 +28 -31
- 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 +2895 -2459
- 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 +11 -11
- 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 +212 -235
- 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 +93 -97
- 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 +7 -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 +7 -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.0.dist-info → python_openstackclient-7.0.0.dist-info}/AUTHORS +4 -0
- {python_openstackclient-6.6.0.dist-info → python_openstackclient-7.0.0.dist-info}/METADATA +3 -3
- python_openstackclient-7.0.0.dist-info/RECORD +502 -0
- {python_openstackclient-6.6.0.dist-info → python_openstackclient-7.0.0.dist-info}/entry_points.txt +33 -27
- python_openstackclient-7.0.0.dist-info/pbr.json +1 -0
- python_openstackclient-6.6.0.dist-info/RECORD +0 -489
- python_openstackclient-6.6.0.dist-info/pbr.json +0 -1
- {python_openstackclient-6.6.0.dist-info → python_openstackclient-7.0.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-6.6.0.dist-info → python_openstackclient-7.0.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-6.6.0.dist-info → python_openstackclient-7.0.0.dist-info}/top_level.txt +0 -0
|
@@ -17,43 +17,23 @@ import contextlib
|
|
|
17
17
|
from unittest import mock
|
|
18
18
|
|
|
19
19
|
from osc_lib import exceptions
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
from openstack import exceptions as sdk_exc
|
|
22
|
+
from openstack.identity.v3 import domain as _domain
|
|
23
|
+
from openstack.identity.v3 import group as _group
|
|
24
|
+
from openstack.identity.v3 import project as _project
|
|
25
|
+
from openstack.identity.v3 import role_assignment as _role_assignment
|
|
26
|
+
from openstack.identity.v3 import user as _user
|
|
27
|
+
from openstack.test import fakes as sdk_fakes
|
|
21
28
|
|
|
22
29
|
from openstackclient.identity import common
|
|
23
30
|
from openstackclient.identity.v3 import user
|
|
24
31
|
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
|
|
25
32
|
|
|
26
33
|
|
|
27
|
-
class
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# Get a shortcut to the DomainManager Mock
|
|
32
|
-
self.domains_mock = self.app.client_manager.identity.domains
|
|
33
|
-
self.domains_mock.reset_mock()
|
|
34
|
-
|
|
35
|
-
# Get a shortcut to the ProjectManager Mock
|
|
36
|
-
self.projects_mock = self.app.client_manager.identity.projects
|
|
37
|
-
self.projects_mock.reset_mock()
|
|
38
|
-
|
|
39
|
-
# Get a shortcut to the GroupManager Mock
|
|
40
|
-
self.groups_mock = self.app.client_manager.identity.groups
|
|
41
|
-
self.groups_mock.reset_mock()
|
|
42
|
-
|
|
43
|
-
# Get a shortcut to the UserManager Mock
|
|
44
|
-
self.users_mock = self.app.client_manager.identity.users
|
|
45
|
-
self.users_mock.reset_mock()
|
|
46
|
-
|
|
47
|
-
# Shortcut for RoleAssignmentManager Mock
|
|
48
|
-
self.role_assignments_mock = (
|
|
49
|
-
self.app.client_manager.identity.role_assignments
|
|
50
|
-
)
|
|
51
|
-
self.role_assignments_mock.reset_mock()
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class TestUserCreate(TestUser):
|
|
55
|
-
domain = identity_fakes.FakeDomain.create_one_domain()
|
|
56
|
-
project = identity_fakes.FakeProject.create_one_project()
|
|
34
|
+
class TestUserCreate(identity_fakes.TestIdentityv3):
|
|
35
|
+
domain = sdk_fakes.generate_fake_resource(_domain.Domain)
|
|
36
|
+
project = sdk_fakes.generate_fake_resource(_project.Project)
|
|
57
37
|
|
|
58
38
|
columns = (
|
|
59
39
|
'default_project_id',
|
|
@@ -62,16 +42,17 @@ class TestUserCreate(TestUser):
|
|
|
62
42
|
'enabled',
|
|
63
43
|
'id',
|
|
64
44
|
'name',
|
|
45
|
+
'description',
|
|
46
|
+
'password_expires_at',
|
|
65
47
|
)
|
|
66
48
|
|
|
67
49
|
def setUp(self):
|
|
68
|
-
super(
|
|
50
|
+
super().setUp()
|
|
69
51
|
|
|
70
|
-
self.user =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
52
|
+
self.user = sdk_fakes.generate_fake_resource(
|
|
53
|
+
resource_type=_user.User,
|
|
54
|
+
domain_id=self.domain.id,
|
|
55
|
+
default_project_id=self.project.id,
|
|
75
56
|
)
|
|
76
57
|
self.datalist = (
|
|
77
58
|
self.project.id,
|
|
@@ -80,11 +61,13 @@ class TestUserCreate(TestUser):
|
|
|
80
61
|
True,
|
|
81
62
|
self.user.id,
|
|
82
63
|
self.user.name,
|
|
64
|
+
self.user.description,
|
|
65
|
+
self.user.password_expires_at,
|
|
83
66
|
)
|
|
84
67
|
|
|
85
|
-
self.
|
|
86
|
-
self.
|
|
87
|
-
self.
|
|
68
|
+
self.identity_sdk_client.find_domain.return_value = self.domain
|
|
69
|
+
self.identity_sdk_client.find_project.return_value = self.project
|
|
70
|
+
self.identity_sdk_client.create_user.return_value = self.user
|
|
88
71
|
|
|
89
72
|
# Get the command object to test
|
|
90
73
|
self.cmd = user.CreateUser(self.app, None)
|
|
@@ -108,18 +91,15 @@ class TestUserCreate(TestUser):
|
|
|
108
91
|
# Set expected values
|
|
109
92
|
kwargs = {
|
|
110
93
|
'name': self.user.name,
|
|
111
|
-
'
|
|
94
|
+
'default_project_id': None,
|
|
112
95
|
'description': None,
|
|
113
|
-
'
|
|
96
|
+
'domain_id': None,
|
|
114
97
|
'email': None,
|
|
115
98
|
'options': {},
|
|
116
|
-
'
|
|
99
|
+
'is_enabled': True,
|
|
117
100
|
'password': None,
|
|
118
101
|
}
|
|
119
|
-
|
|
120
|
-
# UserManager.create(name=, domain=, project=, password=, email=,
|
|
121
|
-
# description=, enabled=, default_project=)
|
|
122
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
102
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
123
103
|
|
|
124
104
|
self.assertEqual(self.columns, columns)
|
|
125
105
|
self.assertEqual(self.datalist, data)
|
|
@@ -147,17 +127,16 @@ class TestUserCreate(TestUser):
|
|
|
147
127
|
# Set expected values
|
|
148
128
|
kwargs = {
|
|
149
129
|
'name': self.user.name,
|
|
150
|
-
'
|
|
130
|
+
'default_project_id': None,
|
|
151
131
|
'description': None,
|
|
152
|
-
'
|
|
132
|
+
'domain_id': None,
|
|
153
133
|
'email': None,
|
|
154
134
|
'options': {},
|
|
155
|
-
'
|
|
135
|
+
'is_enabled': True,
|
|
156
136
|
'password': 'secret',
|
|
157
137
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
138
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
139
|
+
|
|
161
140
|
self.assertEqual(self.columns, columns)
|
|
162
141
|
self.assertEqual(self.datalist, data)
|
|
163
142
|
|
|
@@ -186,17 +165,15 @@ class TestUserCreate(TestUser):
|
|
|
186
165
|
# Set expected values
|
|
187
166
|
kwargs = {
|
|
188
167
|
'name': self.user.name,
|
|
189
|
-
'
|
|
168
|
+
'default_project_id': None,
|
|
190
169
|
'description': None,
|
|
191
|
-
'
|
|
170
|
+
'domain_id': None,
|
|
192
171
|
'email': None,
|
|
193
172
|
'options': {},
|
|
194
|
-
'
|
|
173
|
+
'is_enabled': True,
|
|
195
174
|
'password': 'abc123',
|
|
196
175
|
}
|
|
197
|
-
|
|
198
|
-
# description=, enabled=, default_project=)
|
|
199
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
176
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
200
177
|
|
|
201
178
|
self.assertEqual(self.columns, columns)
|
|
202
179
|
self.assertEqual(self.datalist, data)
|
|
@@ -223,17 +200,15 @@ class TestUserCreate(TestUser):
|
|
|
223
200
|
# Set expected values
|
|
224
201
|
kwargs = {
|
|
225
202
|
'name': self.user.name,
|
|
226
|
-
'
|
|
203
|
+
'default_project_id': None,
|
|
227
204
|
'description': None,
|
|
228
|
-
'
|
|
205
|
+
'domain_id': None,
|
|
229
206
|
'email': 'barney@example.com',
|
|
230
|
-
'
|
|
207
|
+
'is_enabled': True,
|
|
231
208
|
'options': {},
|
|
232
209
|
'password': None,
|
|
233
210
|
}
|
|
234
|
-
|
|
235
|
-
# description=, enabled=, default_project=)
|
|
236
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
211
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
237
212
|
|
|
238
213
|
self.assertEqual(self.columns, columns)
|
|
239
214
|
self.assertEqual(self.datalist, data)
|
|
@@ -260,17 +235,15 @@ class TestUserCreate(TestUser):
|
|
|
260
235
|
# Set expected values
|
|
261
236
|
kwargs = {
|
|
262
237
|
'name': self.user.name,
|
|
263
|
-
'
|
|
238
|
+
'default_project_id': self.project.id,
|
|
264
239
|
'description': None,
|
|
265
|
-
'
|
|
240
|
+
'domain_id': None,
|
|
266
241
|
'email': None,
|
|
267
|
-
'
|
|
242
|
+
'is_enabled': True,
|
|
268
243
|
'options': {},
|
|
269
244
|
'password': None,
|
|
270
245
|
}
|
|
271
|
-
|
|
272
|
-
# description=, enabled=, default_project=)
|
|
273
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
246
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
274
247
|
|
|
275
248
|
self.assertEqual(self.columns, columns)
|
|
276
249
|
datalist = (
|
|
@@ -280,6 +253,8 @@ class TestUserCreate(TestUser):
|
|
|
280
253
|
True,
|
|
281
254
|
self.user.id,
|
|
282
255
|
self.user.name,
|
|
256
|
+
self.user.description,
|
|
257
|
+
self.user.password_expires_at,
|
|
283
258
|
)
|
|
284
259
|
self.assertEqual(datalist, data)
|
|
285
260
|
|
|
@@ -308,17 +283,15 @@ class TestUserCreate(TestUser):
|
|
|
308
283
|
# Set expected values
|
|
309
284
|
kwargs = {
|
|
310
285
|
'name': self.user.name,
|
|
311
|
-
'
|
|
286
|
+
'default_project_id': self.project.id,
|
|
312
287
|
'description': None,
|
|
313
|
-
'
|
|
288
|
+
'domain_id': None,
|
|
314
289
|
'email': None,
|
|
315
290
|
'options': {},
|
|
316
|
-
'
|
|
291
|
+
'is_enabled': True,
|
|
317
292
|
'password': None,
|
|
318
293
|
}
|
|
319
|
-
|
|
320
|
-
# description=, enabled=, default_project=)
|
|
321
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
294
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
322
295
|
|
|
323
296
|
self.assertEqual(self.columns, columns)
|
|
324
297
|
datalist = (
|
|
@@ -328,6 +301,8 @@ class TestUserCreate(TestUser):
|
|
|
328
301
|
True,
|
|
329
302
|
self.user.id,
|
|
330
303
|
self.user.name,
|
|
304
|
+
self.user.description,
|
|
305
|
+
self.user.password_expires_at,
|
|
331
306
|
)
|
|
332
307
|
self.assertEqual(datalist, data)
|
|
333
308
|
|
|
@@ -353,17 +328,15 @@ class TestUserCreate(TestUser):
|
|
|
353
328
|
# Set expected values
|
|
354
329
|
kwargs = {
|
|
355
330
|
'name': self.user.name,
|
|
356
|
-
'
|
|
331
|
+
'default_project_id': None,
|
|
357
332
|
'description': None,
|
|
358
|
-
'
|
|
333
|
+
'domain_id': self.domain.id,
|
|
359
334
|
'email': None,
|
|
360
335
|
'options': {},
|
|
361
|
-
'
|
|
336
|
+
'is_enabled': True,
|
|
362
337
|
'password': None,
|
|
363
338
|
}
|
|
364
|
-
|
|
365
|
-
# description=, enabled=, default_project=)
|
|
366
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
339
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
367
340
|
|
|
368
341
|
self.assertEqual(self.columns, columns)
|
|
369
342
|
self.assertEqual(self.datalist, data)
|
|
@@ -388,17 +361,15 @@ class TestUserCreate(TestUser):
|
|
|
388
361
|
# Set expected values
|
|
389
362
|
kwargs = {
|
|
390
363
|
'name': self.user.name,
|
|
391
|
-
'
|
|
364
|
+
'default_project_id': None,
|
|
392
365
|
'description': None,
|
|
393
|
-
'
|
|
366
|
+
'domain_id': None,
|
|
394
367
|
'email': None,
|
|
395
368
|
'options': {},
|
|
396
|
-
'
|
|
369
|
+
'is_enabled': True,
|
|
397
370
|
'password': None,
|
|
398
371
|
}
|
|
399
|
-
|
|
400
|
-
# description=, enabled=, default_project=)
|
|
401
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
372
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
402
373
|
|
|
403
374
|
self.assertEqual(self.columns, columns)
|
|
404
375
|
self.assertEqual(self.datalist, data)
|
|
@@ -423,16 +394,16 @@ class TestUserCreate(TestUser):
|
|
|
423
394
|
# Set expected values
|
|
424
395
|
kwargs = {
|
|
425
396
|
'name': self.user.name,
|
|
426
|
-
'
|
|
397
|
+
'default_project_id': None,
|
|
427
398
|
'description': None,
|
|
428
|
-
'
|
|
399
|
+
'domain_id': None,
|
|
429
400
|
'email': None,
|
|
430
401
|
'options': {},
|
|
431
|
-
'
|
|
402
|
+
'is_enabled': False,
|
|
432
403
|
'password': None,
|
|
433
404
|
}
|
|
434
|
-
|
|
435
|
-
|
|
405
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
406
|
+
|
|
436
407
|
self.assertEqual(self.columns, columns)
|
|
437
408
|
self.assertEqual(self.datalist, data)
|
|
438
409
|
|
|
@@ -457,17 +428,15 @@ class TestUserCreate(TestUser):
|
|
|
457
428
|
# Set expected values
|
|
458
429
|
kwargs = {
|
|
459
430
|
'name': self.user.name,
|
|
460
|
-
'
|
|
431
|
+
'default_project_id': None,
|
|
461
432
|
'description': None,
|
|
462
|
-
'
|
|
433
|
+
'domain_id': None,
|
|
463
434
|
'email': None,
|
|
464
|
-
'
|
|
435
|
+
'is_enabled': True,
|
|
465
436
|
'options': {'ignore_lockout_failure_attempts': True},
|
|
466
437
|
'password': None,
|
|
467
438
|
}
|
|
468
|
-
|
|
469
|
-
# description=, enabled=, default_project=)
|
|
470
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
439
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
471
440
|
|
|
472
441
|
self.assertEqual(self.columns, columns)
|
|
473
442
|
self.assertEqual(self.datalist, data)
|
|
@@ -493,17 +462,15 @@ class TestUserCreate(TestUser):
|
|
|
493
462
|
# Set expected values
|
|
494
463
|
kwargs = {
|
|
495
464
|
'name': self.user.name,
|
|
496
|
-
'
|
|
465
|
+
'default_project_id': None,
|
|
497
466
|
'description': None,
|
|
498
|
-
'
|
|
467
|
+
'domain_id': None,
|
|
499
468
|
'email': None,
|
|
500
|
-
'
|
|
469
|
+
'is_enabled': True,
|
|
501
470
|
'options': {'ignore_lockout_failure_attempts': False},
|
|
502
471
|
'password': None,
|
|
503
472
|
}
|
|
504
|
-
|
|
505
|
-
# description=, enabled=, default_project=)
|
|
506
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
473
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
507
474
|
|
|
508
475
|
self.assertEqual(self.columns, columns)
|
|
509
476
|
self.assertEqual(self.datalist, data)
|
|
@@ -529,17 +496,15 @@ class TestUserCreate(TestUser):
|
|
|
529
496
|
# Set expected values
|
|
530
497
|
kwargs = {
|
|
531
498
|
'name': self.user.name,
|
|
532
|
-
'
|
|
499
|
+
'default_project_id': None,
|
|
533
500
|
'description': None,
|
|
534
|
-
'
|
|
501
|
+
'domain_id': None,
|
|
535
502
|
'email': None,
|
|
536
|
-
'
|
|
503
|
+
'is_enabled': True,
|
|
537
504
|
'options': {'ignore_password_expiry': True},
|
|
538
505
|
'password': None,
|
|
539
506
|
}
|
|
540
|
-
|
|
541
|
-
# description=, enabled=, default_project=)
|
|
542
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
507
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
543
508
|
|
|
544
509
|
self.assertEqual(self.columns, columns)
|
|
545
510
|
self.assertEqual(self.datalist, data)
|
|
@@ -565,17 +530,15 @@ class TestUserCreate(TestUser):
|
|
|
565
530
|
# Set expected values
|
|
566
531
|
kwargs = {
|
|
567
532
|
'name': self.user.name,
|
|
568
|
-
'
|
|
533
|
+
'default_project_id': None,
|
|
569
534
|
'description': None,
|
|
570
|
-
'
|
|
535
|
+
'domain_id': None,
|
|
571
536
|
'email': None,
|
|
572
|
-
'
|
|
537
|
+
'is_enabled': True,
|
|
573
538
|
'options': {'ignore_password_expiry': False},
|
|
574
539
|
'password': None,
|
|
575
540
|
}
|
|
576
|
-
|
|
577
|
-
# description=, enabled=, default_project=)
|
|
578
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
541
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
579
542
|
|
|
580
543
|
self.assertEqual(self.columns, columns)
|
|
581
544
|
self.assertEqual(self.datalist, data)
|
|
@@ -601,17 +564,15 @@ class TestUserCreate(TestUser):
|
|
|
601
564
|
# Set expected values
|
|
602
565
|
kwargs = {
|
|
603
566
|
'name': self.user.name,
|
|
604
|
-
'
|
|
567
|
+
'default_project_id': None,
|
|
605
568
|
'description': None,
|
|
606
|
-
'
|
|
569
|
+
'domain_id': None,
|
|
607
570
|
'email': None,
|
|
608
|
-
'
|
|
571
|
+
'is_enabled': True,
|
|
609
572
|
'options': {'ignore_change_password_upon_first_use': True},
|
|
610
573
|
'password': None,
|
|
611
574
|
}
|
|
612
|
-
|
|
613
|
-
# description=, enabled=, default_project=)
|
|
614
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
575
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
615
576
|
|
|
616
577
|
self.assertEqual(self.columns, columns)
|
|
617
578
|
self.assertEqual(self.datalist, data)
|
|
@@ -637,17 +598,15 @@ class TestUserCreate(TestUser):
|
|
|
637
598
|
# Set expected values
|
|
638
599
|
kwargs = {
|
|
639
600
|
'name': self.user.name,
|
|
640
|
-
'
|
|
601
|
+
'default_project_id': None,
|
|
641
602
|
'description': None,
|
|
642
|
-
'
|
|
603
|
+
'domain_id': None,
|
|
643
604
|
'email': None,
|
|
644
|
-
'
|
|
605
|
+
'is_enabled': True,
|
|
645
606
|
'options': {'ignore_change_password_upon_first_use': False},
|
|
646
607
|
'password': None,
|
|
647
608
|
}
|
|
648
|
-
|
|
649
|
-
# description=, enabled=, default_project=)
|
|
650
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
609
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
651
610
|
|
|
652
611
|
self.assertEqual(self.columns, columns)
|
|
653
612
|
self.assertEqual(self.datalist, data)
|
|
@@ -673,17 +632,15 @@ class TestUserCreate(TestUser):
|
|
|
673
632
|
# Set expected values
|
|
674
633
|
kwargs = {
|
|
675
634
|
'name': self.user.name,
|
|
676
|
-
'
|
|
635
|
+
'default_project_id': None,
|
|
677
636
|
'description': None,
|
|
678
|
-
'
|
|
637
|
+
'domain_id': None,
|
|
679
638
|
'email': None,
|
|
680
|
-
'
|
|
639
|
+
'is_enabled': True,
|
|
681
640
|
'options': {'lock_password': True},
|
|
682
641
|
'password': None,
|
|
683
642
|
}
|
|
684
|
-
|
|
685
|
-
# description=, enabled=, default_project=)
|
|
686
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
643
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
687
644
|
|
|
688
645
|
self.assertEqual(self.columns, columns)
|
|
689
646
|
self.assertEqual(self.datalist, data)
|
|
@@ -709,17 +666,15 @@ class TestUserCreate(TestUser):
|
|
|
709
666
|
# Set expected values
|
|
710
667
|
kwargs = {
|
|
711
668
|
'name': self.user.name,
|
|
712
|
-
'
|
|
669
|
+
'default_project_id': None,
|
|
713
670
|
'description': None,
|
|
714
|
-
'
|
|
671
|
+
'domain_id': None,
|
|
715
672
|
'email': None,
|
|
716
|
-
'
|
|
673
|
+
'is_enabled': True,
|
|
717
674
|
'options': {'lock_password': False},
|
|
718
675
|
'password': None,
|
|
719
676
|
}
|
|
720
|
-
|
|
721
|
-
# description=, enabled=, default_project=)
|
|
722
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
677
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
723
678
|
|
|
724
679
|
self.assertEqual(self.columns, columns)
|
|
725
680
|
self.assertEqual(self.datalist, data)
|
|
@@ -745,17 +700,15 @@ class TestUserCreate(TestUser):
|
|
|
745
700
|
# Set expected values
|
|
746
701
|
kwargs = {
|
|
747
702
|
'name': self.user.name,
|
|
748
|
-
'
|
|
703
|
+
'default_project_id': None,
|
|
749
704
|
'description': None,
|
|
750
|
-
'
|
|
705
|
+
'domain_id': None,
|
|
751
706
|
'email': None,
|
|
752
|
-
'
|
|
707
|
+
'is_enabled': True,
|
|
753
708
|
'options': {'multi_factor_auth_enabled': True},
|
|
754
709
|
'password': None,
|
|
755
710
|
}
|
|
756
|
-
|
|
757
|
-
# description=, enabled=, default_project=)
|
|
758
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
711
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
759
712
|
|
|
760
713
|
self.assertEqual(self.columns, columns)
|
|
761
714
|
self.assertEqual(self.datalist, data)
|
|
@@ -781,17 +734,15 @@ class TestUserCreate(TestUser):
|
|
|
781
734
|
# Set expected values
|
|
782
735
|
kwargs = {
|
|
783
736
|
'name': self.user.name,
|
|
784
|
-
'
|
|
737
|
+
'default_project_id': None,
|
|
785
738
|
'description': None,
|
|
786
|
-
'
|
|
739
|
+
'domain_id': None,
|
|
787
740
|
'email': None,
|
|
788
|
-
'
|
|
741
|
+
'is_enabled': True,
|
|
789
742
|
'options': {'multi_factor_auth_enabled': False},
|
|
790
743
|
'password': None,
|
|
791
744
|
}
|
|
792
|
-
|
|
793
|
-
# description=, enabled=, default_project=)
|
|
794
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
745
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
795
746
|
|
|
796
747
|
self.assertEqual(self.columns, columns)
|
|
797
748
|
self.assertEqual(self.datalist, data)
|
|
@@ -823,19 +774,17 @@ class TestUserCreate(TestUser):
|
|
|
823
774
|
# Set expected values
|
|
824
775
|
kwargs = {
|
|
825
776
|
'name': self.user.name,
|
|
826
|
-
'
|
|
777
|
+
'default_project_id': None,
|
|
827
778
|
'description': None,
|
|
828
|
-
'
|
|
779
|
+
'domain_id': None,
|
|
829
780
|
'email': None,
|
|
830
|
-
'
|
|
781
|
+
'is_enabled': True,
|
|
831
782
|
'options': {
|
|
832
783
|
'multi_factor_auth_rules': [["password", "totp"], ["password"]]
|
|
833
784
|
},
|
|
834
785
|
'password': None,
|
|
835
786
|
}
|
|
836
|
-
|
|
837
|
-
# description=, enabled=, default_project=)
|
|
838
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
787
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
839
788
|
|
|
840
789
|
self.assertEqual(self.columns, columns)
|
|
841
790
|
self.assertEqual(self.datalist, data)
|
|
@@ -866,11 +815,11 @@ class TestUserCreate(TestUser):
|
|
|
866
815
|
# Set expected values
|
|
867
816
|
kwargs = {
|
|
868
817
|
'name': self.user.name,
|
|
869
|
-
'
|
|
818
|
+
'default_project_id': None,
|
|
870
819
|
'description': None,
|
|
871
|
-
'
|
|
820
|
+
'domain_id': None,
|
|
872
821
|
'email': None,
|
|
873
|
-
'
|
|
822
|
+
'is_enabled': True,
|
|
874
823
|
'options': {
|
|
875
824
|
'ignore_password_expiry': True,
|
|
876
825
|
'multi_factor_auth_enabled': False,
|
|
@@ -878,23 +827,20 @@ class TestUserCreate(TestUser):
|
|
|
878
827
|
},
|
|
879
828
|
'password': None,
|
|
880
829
|
}
|
|
881
|
-
|
|
882
|
-
# description=, enabled=, default_project=)
|
|
883
|
-
self.users_mock.create.assert_called_with(**kwargs)
|
|
830
|
+
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
|
|
884
831
|
|
|
885
832
|
self.assertEqual(self.columns, columns)
|
|
886
833
|
self.assertEqual(self.datalist, data)
|
|
887
834
|
|
|
888
835
|
|
|
889
|
-
class TestUserDelete(
|
|
890
|
-
user =
|
|
836
|
+
class TestUserDelete(identity_fakes.TestIdentityv3):
|
|
837
|
+
user = sdk_fakes.generate_fake_resource(_user.User)
|
|
891
838
|
|
|
892
839
|
def setUp(self):
|
|
893
|
-
super(
|
|
840
|
+
super().setUp()
|
|
894
841
|
|
|
895
|
-
|
|
896
|
-
self.
|
|
897
|
-
self.users_mock.delete.return_value = None
|
|
842
|
+
self.identity_sdk_client.find_user.return_value = self.user
|
|
843
|
+
self.identity_sdk_client.delete_user.return_value = None
|
|
898
844
|
|
|
899
845
|
# Get the command object to test
|
|
900
846
|
self.cmd = user.DeleteUser(self.app, None)
|
|
@@ -910,14 +856,18 @@ class TestUserDelete(TestUser):
|
|
|
910
856
|
|
|
911
857
|
result = self.cmd.take_action(parsed_args)
|
|
912
858
|
|
|
913
|
-
self.
|
|
859
|
+
self.identity_sdk_client.delete_user.assert_called_with(
|
|
914
860
|
self.user.id,
|
|
861
|
+
ignore_missing=False,
|
|
915
862
|
)
|
|
916
863
|
self.assertIsNone(result)
|
|
917
864
|
|
|
918
|
-
@mock.patch.object(
|
|
865
|
+
@mock.patch.object(_user.User, 'find')
|
|
919
866
|
def test_delete_multi_users_with_exception(self, find_mock):
|
|
920
|
-
|
|
867
|
+
self.identity_sdk_client.find_user.side_effect = [
|
|
868
|
+
self.user,
|
|
869
|
+
sdk_exc.ResourceNotFound,
|
|
870
|
+
]
|
|
921
871
|
arglist = [
|
|
922
872
|
self.user.id,
|
|
923
873
|
'unexist_user',
|
|
@@ -933,24 +883,30 @@ class TestUserDelete(TestUser):
|
|
|
933
883
|
except exceptions.CommandError as e:
|
|
934
884
|
self.assertEqual('1 of 2 users failed to delete.', str(e))
|
|
935
885
|
|
|
936
|
-
|
|
937
|
-
|
|
886
|
+
self.identity_sdk_client.find_user.assert_has_calls(
|
|
887
|
+
[
|
|
888
|
+
mock.call(name_or_id=self.user.id, ignore_missing=False),
|
|
889
|
+
mock.call(name_or_id='unexist_user', ignore_missing=False),
|
|
890
|
+
]
|
|
891
|
+
)
|
|
938
892
|
|
|
939
|
-
self.assertEqual(2,
|
|
940
|
-
self.
|
|
893
|
+
self.assertEqual(2, self.identity_sdk_client.find_user.call_count)
|
|
894
|
+
self.identity_sdk_client.delete_user.assert_called_once_with(
|
|
895
|
+
self.user.id, ignore_missing=False
|
|
896
|
+
)
|
|
941
897
|
|
|
942
898
|
|
|
943
|
-
class TestUserList(
|
|
944
|
-
domain =
|
|
945
|
-
project =
|
|
946
|
-
user =
|
|
947
|
-
|
|
899
|
+
class TestUserList(identity_fakes.TestIdentityv3):
|
|
900
|
+
domain = sdk_fakes.generate_fake_resource(_domain.Domain)
|
|
901
|
+
project = sdk_fakes.generate_fake_resource(_project.Project)
|
|
902
|
+
user = sdk_fakes.generate_fake_resource(
|
|
903
|
+
resource_type=_user.User,
|
|
904
|
+
domain_id=domain.id,
|
|
905
|
+
default_project_id=project.id,
|
|
948
906
|
)
|
|
949
|
-
group =
|
|
950
|
-
role_assignment = (
|
|
951
|
-
|
|
952
|
-
attrs={'user': {'id': user.id}}
|
|
953
|
-
)
|
|
907
|
+
group = sdk_fakes.generate_fake_resource(_group.Group)
|
|
908
|
+
role_assignment = sdk_fakes.generate_fake_resource(
|
|
909
|
+
resource_type=_role_assignment.RoleAssignment, user={'id': user.id}
|
|
954
910
|
)
|
|
955
911
|
|
|
956
912
|
columns = ['ID', 'Name']
|
|
@@ -962,14 +918,17 @@ class TestUserList(TestUser):
|
|
|
962
918
|
)
|
|
963
919
|
|
|
964
920
|
def setUp(self):
|
|
965
|
-
super(
|
|
921
|
+
super().setUp()
|
|
966
922
|
|
|
967
|
-
self.
|
|
968
|
-
self.
|
|
969
|
-
self.
|
|
970
|
-
self.
|
|
971
|
-
self.
|
|
972
|
-
self.
|
|
923
|
+
self.identity_sdk_client.find_user.return_value = self.user
|
|
924
|
+
self.identity_sdk_client.users.return_value = [self.user]
|
|
925
|
+
self.identity_sdk_client.group_users.return_value = [self.user]
|
|
926
|
+
self.identity_sdk_client.find_domain.return_value = self.domain
|
|
927
|
+
self.identity_sdk_client.find_group.return_value = self.group
|
|
928
|
+
self.identity_sdk_client.find_project.return_value = self.project
|
|
929
|
+
self.identity_sdk_client.role_assignments_filter.return_value = [
|
|
930
|
+
self.role_assignment
|
|
931
|
+
]
|
|
973
932
|
|
|
974
933
|
# Get the command object to test
|
|
975
934
|
self.cmd = user.ListUser(self.app, None)
|
|
@@ -986,11 +945,10 @@ class TestUserList(TestUser):
|
|
|
986
945
|
|
|
987
946
|
# Set expected values
|
|
988
947
|
kwargs = {
|
|
989
|
-
'
|
|
990
|
-
'group': None,
|
|
948
|
+
'domain_id': None,
|
|
991
949
|
}
|
|
992
950
|
|
|
993
|
-
self.
|
|
951
|
+
self.identity_sdk_client.users.assert_called_with(**kwargs)
|
|
994
952
|
|
|
995
953
|
self.assertEqual(self.columns, columns)
|
|
996
954
|
self.assertEqual(self.datalist, tuple(data))
|
|
@@ -1012,11 +970,10 @@ class TestUserList(TestUser):
|
|
|
1012
970
|
|
|
1013
971
|
# Set expected values
|
|
1014
972
|
kwargs = {
|
|
1015
|
-
'
|
|
1016
|
-
'group': None,
|
|
973
|
+
'domain_id': self.domain.id,
|
|
1017
974
|
}
|
|
1018
975
|
|
|
1019
|
-
self.
|
|
976
|
+
self.identity_sdk_client.users.assert_called_with(**kwargs)
|
|
1020
977
|
|
|
1021
978
|
self.assertEqual(self.columns, columns)
|
|
1022
979
|
self.assertEqual(self.datalist, tuple(data))
|
|
@@ -1038,11 +995,11 @@ class TestUserList(TestUser):
|
|
|
1038
995
|
|
|
1039
996
|
# Set expected values
|
|
1040
997
|
kwargs = {
|
|
1041
|
-
'
|
|
998
|
+
'domain_id': None,
|
|
1042
999
|
'group': self.group.id,
|
|
1043
1000
|
}
|
|
1044
1001
|
|
|
1045
|
-
self.
|
|
1002
|
+
self.identity_sdk_client.group_users.assert_called_with(**kwargs)
|
|
1046
1003
|
|
|
1047
1004
|
self.assertEqual(self.columns, columns)
|
|
1048
1005
|
self.assertEqual(self.datalist, tuple(data))
|
|
@@ -1063,11 +1020,10 @@ class TestUserList(TestUser):
|
|
|
1063
1020
|
|
|
1064
1021
|
# Set expected values
|
|
1065
1022
|
kwargs = {
|
|
1066
|
-
'
|
|
1067
|
-
'group': None,
|
|
1023
|
+
'domain_id': None,
|
|
1068
1024
|
}
|
|
1069
1025
|
|
|
1070
|
-
self.
|
|
1026
|
+
self.identity_sdk_client.users.assert_called_with(**kwargs)
|
|
1071
1027
|
|
|
1072
1028
|
collist = [
|
|
1073
1029
|
'ID',
|
|
@@ -1085,7 +1041,7 @@ class TestUserList(TestUser):
|
|
|
1085
1041
|
self.user.name,
|
|
1086
1042
|
self.project.id,
|
|
1087
1043
|
self.domain.id,
|
|
1088
|
-
|
|
1044
|
+
self.user.description,
|
|
1089
1045
|
self.user.email,
|
|
1090
1046
|
True,
|
|
1091
1047
|
),
|
|
@@ -1111,29 +1067,32 @@ class TestUserList(TestUser):
|
|
|
1111
1067
|
'project': self.project.id,
|
|
1112
1068
|
}
|
|
1113
1069
|
|
|
1114
|
-
self.
|
|
1115
|
-
|
|
1070
|
+
self.identity_sdk_client.role_assignments_filter.assert_called_with(
|
|
1071
|
+
**kwargs
|
|
1072
|
+
)
|
|
1116
1073
|
|
|
1117
1074
|
self.assertEqual(self.columns, columns)
|
|
1118
1075
|
self.assertEqual(self.datalist, tuple(data))
|
|
1119
1076
|
|
|
1120
1077
|
|
|
1121
|
-
class TestUserSet(
|
|
1122
|
-
project =
|
|
1123
|
-
domain =
|
|
1124
|
-
user =
|
|
1125
|
-
|
|
1078
|
+
class TestUserSet(identity_fakes.TestIdentityv3):
|
|
1079
|
+
project = sdk_fakes.generate_fake_resource(_project.Project)
|
|
1080
|
+
domain = sdk_fakes.generate_fake_resource(_domain.Domain)
|
|
1081
|
+
user = sdk_fakes.generate_fake_resource(
|
|
1082
|
+
resource_type=_user.User, default_project_id=project.id
|
|
1126
1083
|
)
|
|
1127
|
-
user2 =
|
|
1128
|
-
|
|
1084
|
+
user2 = sdk_fakes.generate_fake_resource(
|
|
1085
|
+
resource_type=_user.User,
|
|
1086
|
+
default_project_id=project.id,
|
|
1087
|
+
domain_id=domain.id,
|
|
1129
1088
|
)
|
|
1130
1089
|
|
|
1131
1090
|
def setUp(self):
|
|
1132
|
-
super(
|
|
1091
|
+
super().setUp()
|
|
1133
1092
|
|
|
1134
|
-
self.
|
|
1135
|
-
self.
|
|
1136
|
-
self.
|
|
1093
|
+
self.identity_sdk_client.find_project.return_value = self.project
|
|
1094
|
+
self.identity_sdk_client.find_user.return_value = self.user
|
|
1095
|
+
self.identity_sdk_client.update_user.return_value = self.user
|
|
1137
1096
|
|
|
1138
1097
|
# Get the command object to test
|
|
1139
1098
|
self.cmd = user.SetUser(self.app, None)
|
|
@@ -1178,12 +1137,12 @@ class TestUserSet(TestUser):
|
|
|
1178
1137
|
|
|
1179
1138
|
# Set expected values
|
|
1180
1139
|
kwargs = {
|
|
1181
|
-
'
|
|
1140
|
+
'is_enabled': True,
|
|
1182
1141
|
'name': 'qwerty',
|
|
1183
1142
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1143
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1144
|
+
user=self.user, **kwargs
|
|
1145
|
+
)
|
|
1187
1146
|
self.assertIsNone(result)
|
|
1188
1147
|
|
|
1189
1148
|
def test_user_set_specify_domain(self):
|
|
@@ -1208,9 +1167,11 @@ class TestUserSet(TestUser):
|
|
|
1208
1167
|
|
|
1209
1168
|
result = self.cmd.take_action(parsed_args)
|
|
1210
1169
|
|
|
1211
|
-
kwargs = {'
|
|
1170
|
+
kwargs = {'is_enabled': True, 'name': 'qwerty'}
|
|
1212
1171
|
|
|
1213
|
-
self.
|
|
1172
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1173
|
+
user=self.user, **kwargs
|
|
1174
|
+
)
|
|
1214
1175
|
self.assertIsNone(result)
|
|
1215
1176
|
|
|
1216
1177
|
def test_user_set_password(self):
|
|
@@ -1235,12 +1196,12 @@ class TestUserSet(TestUser):
|
|
|
1235
1196
|
|
|
1236
1197
|
# Set expected values
|
|
1237
1198
|
kwargs = {
|
|
1238
|
-
'
|
|
1199
|
+
'is_enabled': True,
|
|
1239
1200
|
'password': 'secret',
|
|
1240
1201
|
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1202
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1203
|
+
user=self.user, **kwargs
|
|
1204
|
+
)
|
|
1244
1205
|
self.assertIsNone(result)
|
|
1245
1206
|
|
|
1246
1207
|
def test_user_set_password_prompt(self):
|
|
@@ -1267,12 +1228,12 @@ class TestUserSet(TestUser):
|
|
|
1267
1228
|
|
|
1268
1229
|
# Set expected values
|
|
1269
1230
|
kwargs = {
|
|
1270
|
-
'
|
|
1231
|
+
'is_enabled': True,
|
|
1271
1232
|
'password': 'abc123',
|
|
1272
1233
|
}
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1234
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1235
|
+
user=self.user, **kwargs
|
|
1236
|
+
)
|
|
1276
1237
|
self.assertIsNone(result)
|
|
1277
1238
|
|
|
1278
1239
|
def test_user_set_email(self):
|
|
@@ -1296,12 +1257,12 @@ class TestUserSet(TestUser):
|
|
|
1296
1257
|
|
|
1297
1258
|
# Set expected values
|
|
1298
1259
|
kwargs = {
|
|
1299
|
-
'
|
|
1260
|
+
'is_enabled': True,
|
|
1300
1261
|
'email': 'barney@example.com',
|
|
1301
1262
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1263
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1264
|
+
user=self.user, **kwargs
|
|
1265
|
+
)
|
|
1305
1266
|
self.assertIsNone(result)
|
|
1306
1267
|
|
|
1307
1268
|
def test_user_set_project(self):
|
|
@@ -1325,12 +1286,12 @@ class TestUserSet(TestUser):
|
|
|
1325
1286
|
|
|
1326
1287
|
# Set expected values
|
|
1327
1288
|
kwargs = {
|
|
1328
|
-
'
|
|
1329
|
-
'
|
|
1289
|
+
'is_enabled': True,
|
|
1290
|
+
'default_project_id': self.project.id,
|
|
1330
1291
|
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1292
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1293
|
+
user=self.user, **kwargs
|
|
1294
|
+
)
|
|
1334
1295
|
self.assertIsNone(result)
|
|
1335
1296
|
|
|
1336
1297
|
def test_user_set_project_domain(self):
|
|
@@ -1357,12 +1318,12 @@ class TestUserSet(TestUser):
|
|
|
1357
1318
|
|
|
1358
1319
|
# Set expected values
|
|
1359
1320
|
kwargs = {
|
|
1360
|
-
'
|
|
1361
|
-
'
|
|
1321
|
+
'is_enabled': True,
|
|
1322
|
+
'default_project_id': self.project.id,
|
|
1362
1323
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1324
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1325
|
+
user=self.user, **kwargs
|
|
1326
|
+
)
|
|
1366
1327
|
self.assertIsNone(result)
|
|
1367
1328
|
|
|
1368
1329
|
def test_user_set_enable(self):
|
|
@@ -1385,11 +1346,11 @@ class TestUserSet(TestUser):
|
|
|
1385
1346
|
|
|
1386
1347
|
# Set expected values
|
|
1387
1348
|
kwargs = {
|
|
1388
|
-
'
|
|
1349
|
+
'is_enabled': True,
|
|
1389
1350
|
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1351
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1352
|
+
user=self.user, **kwargs
|
|
1353
|
+
)
|
|
1393
1354
|
self.assertIsNone(result)
|
|
1394
1355
|
|
|
1395
1356
|
def test_user_set_disable(self):
|
|
@@ -1412,11 +1373,11 @@ class TestUserSet(TestUser):
|
|
|
1412
1373
|
|
|
1413
1374
|
# Set expected values
|
|
1414
1375
|
kwargs = {
|
|
1415
|
-
'
|
|
1376
|
+
'is_enabled': False,
|
|
1416
1377
|
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1378
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1379
|
+
user=self.user, **kwargs
|
|
1380
|
+
)
|
|
1420
1381
|
self.assertIsNone(result)
|
|
1421
1382
|
|
|
1422
1383
|
def test_user_set_ignore_lockout_failure_attempts(self):
|
|
@@ -1439,12 +1400,12 @@ class TestUserSet(TestUser):
|
|
|
1439
1400
|
result = self.cmd.take_action(parsed_args)
|
|
1440
1401
|
# Set expected values
|
|
1441
1402
|
kwargs = {
|
|
1442
|
-
'
|
|
1403
|
+
'is_enabled': True,
|
|
1443
1404
|
'options': {'ignore_lockout_failure_attempts': True},
|
|
1444
1405
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1406
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1407
|
+
user=self.user, **kwargs
|
|
1408
|
+
)
|
|
1448
1409
|
self.assertIsNone(result)
|
|
1449
1410
|
|
|
1450
1411
|
def test_user_set_no_ignore_lockout_failure_attempts(self):
|
|
@@ -1467,12 +1428,12 @@ class TestUserSet(TestUser):
|
|
|
1467
1428
|
result = self.cmd.take_action(parsed_args)
|
|
1468
1429
|
# Set expected values
|
|
1469
1430
|
kwargs = {
|
|
1470
|
-
'
|
|
1431
|
+
'is_enabled': True,
|
|
1471
1432
|
'options': {'ignore_lockout_failure_attempts': False},
|
|
1472
1433
|
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1434
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1435
|
+
user=self.user, **kwargs
|
|
1436
|
+
)
|
|
1476
1437
|
self.assertIsNone(result)
|
|
1477
1438
|
|
|
1478
1439
|
def test_user_set_ignore_password_expiry(self):
|
|
@@ -1495,12 +1456,12 @@ class TestUserSet(TestUser):
|
|
|
1495
1456
|
result = self.cmd.take_action(parsed_args)
|
|
1496
1457
|
# Set expected values
|
|
1497
1458
|
kwargs = {
|
|
1498
|
-
'
|
|
1459
|
+
'is_enabled': True,
|
|
1499
1460
|
'options': {'ignore_password_expiry': True},
|
|
1500
1461
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1462
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1463
|
+
user=self.user, **kwargs
|
|
1464
|
+
)
|
|
1504
1465
|
self.assertIsNone(result)
|
|
1505
1466
|
|
|
1506
1467
|
def test_user_set_no_ignore_password_expiry(self):
|
|
@@ -1523,12 +1484,12 @@ class TestUserSet(TestUser):
|
|
|
1523
1484
|
result = self.cmd.take_action(parsed_args)
|
|
1524
1485
|
# Set expected values
|
|
1525
1486
|
kwargs = {
|
|
1526
|
-
'
|
|
1487
|
+
'is_enabled': True,
|
|
1527
1488
|
'options': {'ignore_password_expiry': False},
|
|
1528
1489
|
}
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1490
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1491
|
+
user=self.user, **kwargs
|
|
1492
|
+
)
|
|
1532
1493
|
self.assertIsNone(result)
|
|
1533
1494
|
|
|
1534
1495
|
def test_user_set_ignore_change_password_upon_first_use(self):
|
|
@@ -1551,12 +1512,12 @@ class TestUserSet(TestUser):
|
|
|
1551
1512
|
result = self.cmd.take_action(parsed_args)
|
|
1552
1513
|
# Set expected values
|
|
1553
1514
|
kwargs = {
|
|
1554
|
-
'
|
|
1515
|
+
'is_enabled': True,
|
|
1555
1516
|
'options': {'ignore_change_password_upon_first_use': True},
|
|
1556
1517
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1518
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1519
|
+
user=self.user, **kwargs
|
|
1520
|
+
)
|
|
1560
1521
|
self.assertIsNone(result)
|
|
1561
1522
|
|
|
1562
1523
|
def test_user_set_no_ignore_change_password_upon_first_use(self):
|
|
@@ -1579,12 +1540,12 @@ class TestUserSet(TestUser):
|
|
|
1579
1540
|
result = self.cmd.take_action(parsed_args)
|
|
1580
1541
|
# Set expected values
|
|
1581
1542
|
kwargs = {
|
|
1582
|
-
'
|
|
1543
|
+
'is_enabled': True,
|
|
1583
1544
|
'options': {'ignore_change_password_upon_first_use': False},
|
|
1584
1545
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1546
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1547
|
+
user=self.user, **kwargs
|
|
1548
|
+
)
|
|
1588
1549
|
self.assertIsNone(result)
|
|
1589
1550
|
|
|
1590
1551
|
def test_user_set_enable_lock_password(self):
|
|
@@ -1607,12 +1568,12 @@ class TestUserSet(TestUser):
|
|
|
1607
1568
|
result = self.cmd.take_action(parsed_args)
|
|
1608
1569
|
# Set expected values
|
|
1609
1570
|
kwargs = {
|
|
1610
|
-
'
|
|
1571
|
+
'is_enabled': True,
|
|
1611
1572
|
'options': {'lock_password': True},
|
|
1612
1573
|
}
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1574
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1575
|
+
user=self.user, **kwargs
|
|
1576
|
+
)
|
|
1616
1577
|
self.assertIsNone(result)
|
|
1617
1578
|
|
|
1618
1579
|
def test_user_set_disable_lock_password(self):
|
|
@@ -1635,12 +1596,12 @@ class TestUserSet(TestUser):
|
|
|
1635
1596
|
result = self.cmd.take_action(parsed_args)
|
|
1636
1597
|
# Set expected values
|
|
1637
1598
|
kwargs = {
|
|
1638
|
-
'
|
|
1599
|
+
'is_enabled': True,
|
|
1639
1600
|
'options': {'lock_password': False},
|
|
1640
1601
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1602
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1603
|
+
user=self.user, **kwargs
|
|
1604
|
+
)
|
|
1644
1605
|
self.assertIsNone(result)
|
|
1645
1606
|
|
|
1646
1607
|
def test_user_set_enable_multi_factor_auth(self):
|
|
@@ -1663,12 +1624,12 @@ class TestUserSet(TestUser):
|
|
|
1663
1624
|
result = self.cmd.take_action(parsed_args)
|
|
1664
1625
|
# Set expected values
|
|
1665
1626
|
kwargs = {
|
|
1666
|
-
'
|
|
1627
|
+
'is_enabled': True,
|
|
1667
1628
|
'options': {'multi_factor_auth_enabled': True},
|
|
1668
1629
|
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1630
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1631
|
+
user=self.user, **kwargs
|
|
1632
|
+
)
|
|
1672
1633
|
self.assertIsNone(result)
|
|
1673
1634
|
|
|
1674
1635
|
def test_user_set_disable_multi_factor_auth(self):
|
|
@@ -1691,12 +1652,12 @@ class TestUserSet(TestUser):
|
|
|
1691
1652
|
result = self.cmd.take_action(parsed_args)
|
|
1692
1653
|
# Set expected values
|
|
1693
1654
|
kwargs = {
|
|
1694
|
-
'
|
|
1655
|
+
'is_enabled': True,
|
|
1695
1656
|
'options': {'multi_factor_auth_enabled': False},
|
|
1696
1657
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1658
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1659
|
+
user=self.user, **kwargs
|
|
1660
|
+
)
|
|
1700
1661
|
self.assertIsNone(result)
|
|
1701
1662
|
|
|
1702
1663
|
def test_user_set_option_multi_factor_auth_rule(self):
|
|
@@ -1720,13 +1681,13 @@ class TestUserSet(TestUser):
|
|
|
1720
1681
|
result = self.cmd.take_action(parsed_args)
|
|
1721
1682
|
# Set expected values
|
|
1722
1683
|
kwargs = {
|
|
1723
|
-
'
|
|
1684
|
+
'is_enabled': True,
|
|
1724
1685
|
'options': {'multi_factor_auth_rules': [["password", "totp"]]},
|
|
1725
1686
|
}
|
|
1726
1687
|
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1688
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1689
|
+
user=self.user, **kwargs
|
|
1690
|
+
)
|
|
1730
1691
|
self.assertIsNone(result)
|
|
1731
1692
|
|
|
1732
1693
|
def test_user_set_with_multiple_options(self):
|
|
@@ -1754,7 +1715,7 @@ class TestUserSet(TestUser):
|
|
|
1754
1715
|
result = self.cmd.take_action(parsed_args)
|
|
1755
1716
|
# Set expected values
|
|
1756
1717
|
kwargs = {
|
|
1757
|
-
'
|
|
1718
|
+
'is_enabled': True,
|
|
1758
1719
|
'options': {
|
|
1759
1720
|
'ignore_password_expiry': True,
|
|
1760
1721
|
'multi_factor_auth_enabled': True,
|
|
@@ -1762,15 +1723,15 @@ class TestUserSet(TestUser):
|
|
|
1762
1723
|
},
|
|
1763
1724
|
}
|
|
1764
1725
|
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1726
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1727
|
+
user=self.user, **kwargs
|
|
1728
|
+
)
|
|
1768
1729
|
self.assertIsNone(result)
|
|
1769
1730
|
|
|
1770
1731
|
|
|
1771
|
-
class TestUserSetPassword(
|
|
1732
|
+
class TestUserSetPassword(identity_fakes.TestIdentityv3):
|
|
1772
1733
|
def setUp(self):
|
|
1773
|
-
super(
|
|
1734
|
+
super().setUp()
|
|
1774
1735
|
self.cmd = user.SetPasswordUser(self.app, None)
|
|
1775
1736
|
|
|
1776
1737
|
@staticmethod
|
|
@@ -1796,8 +1757,8 @@ class TestUserSetPassword(TestUser):
|
|
|
1796
1757
|
with self._mock_get_password(current_pass):
|
|
1797
1758
|
result = self.cmd.take_action(parsed_args)
|
|
1798
1759
|
|
|
1799
|
-
self.
|
|
1800
|
-
current_pass, new_pass
|
|
1760
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1761
|
+
current_password=current_pass, password=new_pass
|
|
1801
1762
|
)
|
|
1802
1763
|
self.assertIsNone(result)
|
|
1803
1764
|
|
|
@@ -1810,8 +1771,8 @@ class TestUserSetPassword(TestUser):
|
|
|
1810
1771
|
with self._mock_get_password(current_pass, new_pass):
|
|
1811
1772
|
result = self.cmd.take_action(parsed_args)
|
|
1812
1773
|
|
|
1813
|
-
self.
|
|
1814
|
-
current_pass, new_pass
|
|
1774
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1775
|
+
current_password=current_pass, password=new_pass
|
|
1815
1776
|
)
|
|
1816
1777
|
self.assertIsNone(result)
|
|
1817
1778
|
|
|
@@ -1832,29 +1793,29 @@ class TestUserSetPassword(TestUser):
|
|
|
1832
1793
|
|
|
1833
1794
|
result = self.cmd.take_action(parsed_args)
|
|
1834
1795
|
|
|
1835
|
-
self.
|
|
1836
|
-
current_pass, new_pass
|
|
1796
|
+
self.identity_sdk_client.update_user.assert_called_with(
|
|
1797
|
+
current_password=current_pass, password=new_pass
|
|
1837
1798
|
)
|
|
1838
1799
|
self.assertIsNone(result)
|
|
1839
1800
|
|
|
1840
1801
|
|
|
1841
|
-
class TestUserShow(
|
|
1842
|
-
user =
|
|
1802
|
+
class TestUserShow(identity_fakes.TestIdentityv3):
|
|
1803
|
+
user = sdk_fakes.generate_fake_resource(_user.User)
|
|
1843
1804
|
|
|
1844
1805
|
def setUp(self):
|
|
1845
|
-
super(
|
|
1806
|
+
super().setUp()
|
|
1846
1807
|
|
|
1847
|
-
self.
|
|
1808
|
+
self.identity_sdk_client.find_user.return_value = self.user
|
|
1848
1809
|
|
|
1849
1810
|
# Get the command object to test
|
|
1850
1811
|
self.cmd = user.ShowUser(self.app, None)
|
|
1851
|
-
self.
|
|
1812
|
+
self.identity_client.auth.client.get_user_id.return_value = ( # noqa: E501
|
|
1852
1813
|
self.user.id
|
|
1853
1814
|
)
|
|
1854
|
-
self.
|
|
1815
|
+
self.identity_client.tokens.get_token_data.return_value = {
|
|
1855
1816
|
'token': {
|
|
1856
1817
|
'user': {
|
|
1857
|
-
'
|
|
1818
|
+
'domain_id': {'id': self.user.domain_id},
|
|
1858
1819
|
'id': self.user.id,
|
|
1859
1820
|
'name': self.user.name,
|
|
1860
1821
|
}
|
|
@@ -1875,7 +1836,9 @@ class TestUserShow(TestUser):
|
|
|
1875
1836
|
# data to be shown.
|
|
1876
1837
|
columns, data = self.cmd.take_action(parsed_args)
|
|
1877
1838
|
|
|
1878
|
-
self.
|
|
1839
|
+
self.identity_sdk_client.find_user.assert_called_with(
|
|
1840
|
+
name_or_id=self.user.id, ignore_missing=False
|
|
1841
|
+
)
|
|
1879
1842
|
|
|
1880
1843
|
collist = (
|
|
1881
1844
|
'default_project_id',
|
|
@@ -1884,6 +1847,8 @@ class TestUserShow(TestUser):
|
|
|
1884
1847
|
'enabled',
|
|
1885
1848
|
'id',
|
|
1886
1849
|
'name',
|
|
1850
|
+
'description',
|
|
1851
|
+
'password_expires_at',
|
|
1887
1852
|
)
|
|
1888
1853
|
self.assertEqual(collist, columns)
|
|
1889
1854
|
datalist = (
|
|
@@ -1893,14 +1858,15 @@ class TestUserShow(TestUser):
|
|
|
1893
1858
|
True,
|
|
1894
1859
|
self.user.id,
|
|
1895
1860
|
self.user.name,
|
|
1861
|
+
self.user.description,
|
|
1862
|
+
self.user.password_expires_at,
|
|
1896
1863
|
)
|
|
1897
1864
|
self.assertEqual(datalist, data)
|
|
1898
1865
|
|
|
1899
1866
|
def test_user_show_with_domain(self):
|
|
1900
|
-
user =
|
|
1901
|
-
|
|
1867
|
+
user = sdk_fakes.generate_fake_resource(
|
|
1868
|
+
resource_type=_user.User, name=self.user.name
|
|
1902
1869
|
)
|
|
1903
|
-
identity_client = self.app.client_manager.identity
|
|
1904
1870
|
|
|
1905
1871
|
arglist = [
|
|
1906
1872
|
"--domain",
|
|
@@ -1914,9 +1880,12 @@ class TestUserShow(TestUser):
|
|
|
1914
1880
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1915
1881
|
|
|
1916
1882
|
user_str = common._get_token_resource(
|
|
1917
|
-
|
|
1883
|
+
self.identity_sdk_client,
|
|
1884
|
+
'user',
|
|
1885
|
+
parsed_args.user,
|
|
1886
|
+
parsed_args.domain,
|
|
1918
1887
|
)
|
|
1919
|
-
self.assertEqual(self.user.
|
|
1888
|
+
self.assertEqual(self.user.name, user_str)
|
|
1920
1889
|
|
|
1921
1890
|
arglist = [
|
|
1922
1891
|
"--domain",
|
|
@@ -1930,6 +1899,9 @@ class TestUserShow(TestUser):
|
|
|
1930
1899
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1931
1900
|
|
|
1932
1901
|
user_str = common._get_token_resource(
|
|
1933
|
-
|
|
1902
|
+
self.identity_sdk_client,
|
|
1903
|
+
'user',
|
|
1904
|
+
parsed_args.user,
|
|
1905
|
+
parsed_args.domain,
|
|
1934
1906
|
)
|
|
1935
1907
|
self.assertEqual(user.name, user_str)
|