keystone.tests.unit.core.
BaseTestCase
(*args, **kwargs)[source]¶Bases: testtools.testcase.TestCase
Light weight base test class.
This is a placeholder that will eventually go away once the setup/teardown in TestCase is properly trimmed down to the bare essentials. This is really just a play to speed up the tests by eliminating unnecessary work.
keystone.tests.unit.core.
SQLDriverOverrides
[source]¶Bases: object
A mixin for consolidating sql-specific test overrides.
keystone.tests.unit.core.
TestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
assertCloseEnoughForGovernmentWork
(a, b, delta=3)[source]¶Assert that two datetimes are nearly equal within a small delta.
Parameters: | delta – Maximum allowable time delta, defined in seconds. |
---|
assertUserDictEqual
(expected, observed, message='')[source]¶Assert that a user dict is equal to another user dict.
User dictionaries have some variable values that should be ignored in the comparison. This method is a helper that strips those elements out when comparing the user dictionary. This normalized these differences that should not change the comparison.
ipv6_enabled
¶keystone.tests.unit.core.
create_user
(api, domain_id, **kwargs)[source]¶Create a user via the API. Keep the created password.
The password is saved and restored when api.create_user() is called. Only use this routine if there is a requirement for the user object to have a valid password after api.create_user() is called.
keystone.tests.unit.core.
new_cert_credential
(user_id, project_id=None, blob=None, **kwargs)[source]¶keystone.tests.unit.core.
new_credential_ref
(user_id, project_id=None, type='cert', **kwargs)[source]¶keystone.tests.unit.core.
new_endpoint_ref
(service_id, interface='public', region_id=<object object>, **kwargs)[source]¶keystone.tests.unit.core.
new_endpoint_ref_with_region
(service_id, region, interface='public', **kwargs)[source]¶Define an endpoint_ref having a pre-3.2 form.
Contains the deprecated ‘region’ instead of ‘region_id’.
keystone.tests.unit.core.
new_trust_ref
(trustor_user_id, trustee_user_id, project_id=None, impersonation=None, expires=None, role_ids=None, role_names=None, remaining_uses=None, allow_redelegation=False, redelegation_count=None, **kwargs)[source]¶keystone.tests.unit.core.
skip_if_cache_disabled
(*sections)[source]¶Skip a test if caching is disabled, this is a decorator.
Caching can be disabled either globally or for a specific section.
In the code fragment:
@skip_if_cache_is_disabled('assignment', 'token')
def test_method(*args):
...
The method test_method would be skipped if caching is disabled globally via the enabled option in the cache section of the configuration or if the caching option is set to false in either assignment or token sections of the configuration. This decorator can be used with no arguments to only check global caching.
If a specified configuration section does not define the caching option, this decorator makes the same assumption as the should_cache_fn in keystone.common.cache that caching should be enabled.
Fake LDAP server for test harness.
This class does very little error checking, and knows nothing about ldap class definitions. It implements the minimum emulation of the python ldap library to work with keystone.
keystone.tests.unit.fakeldap.
FakeLdap
(conn=None)[source]¶Bases: keystone.identity.backends.ldap.common.LDAPHandler
Emulate the python-ldap API.
The python-ldap API requires all strings to be UTF-8 encoded. This is assured by the caller of this interface (i.e. KeystoneLDAPHandler).
However, internally this emulation MUST process and store strings in a canonical form which permits operations on characters. Encoded strings do not provide the ability to operate on characters. Therefore this emulation accepts UTF-8 encoded strings, decodes them to unicode for operations internal to this emulation, and encodes them back to UTF-8 when returning values from the emulation.
connect
(url, page_size=0, alias_dereferencing=None, use_tls=False, tls_cacertfile=None, tls_cacertdir=None, tls_req_cert='demand', chase_referrals=None, debug_level=None, use_pool=None, pool_size=None, pool_retry_max=None, pool_retry_delay=None, pool_conn_timeout=None, pool_conn_lifetime=None, conn_timeout=None)[source]¶modify_s
(dn, modlist)[source]¶Modify the object at dn using the attribute list.
Parameters: |
|
---|
result3
(msgid=-1, all=1, timeout=None, resp_ctrl_classes=None)[source]¶Execute async request.
Only msgid param is supported. Request info is fetched from global variable PendingRequests by msgid, executed using search_s and limited if requested.
search_ext
(base, scope, filterstr='(objectClass=*)', attrlist=None, attrsonly=0, serverctrls=None, clientctrls=None, timeout=-1, sizelimit=0)[source]¶search_s
(base, scope, filterstr='(objectClass=*)', attrlist=None, attrsonly=0)[source]¶Search for all matching objects under base using the query.
Args: base – dn to search under scope – search scope (base, subtree, onelevel) filterstr – filter objects by attrlist – attrs to return. Returns all attrs if not specified
keystone.tests.unit.fakeldap.
FakeLdapNoSubtreeDelete
(conn=None)[source]¶Bases: keystone.tests.unit.fakeldap.FakeLdap
FakeLdap subclass that does not support subtree delete.
Same as FakeLdap except delete will throw the LDAP error ldap.NOT_ALLOWED_ON_NONLEAF if there is an attempt to delete an entry that has children.
keystone.tests.unit.fakeldap.
FakeLdapPool
(uri, retry_max=None, retry_delay=None, conn=None)[source]¶Bases: keystone.tests.unit.fakeldap.FakeLdap
Emulate the python-ldap API with pooled connections.
This class is used as connector class in PooledLDAPHandler.
Fixtures for Federation Mapping.
keystone.tests.unit.test_backend_endpoint_policy.
PolicyAssociationTests
[source]¶Bases: object
load_sample_data
()[source]¶Create sample data to test policy associations.
The following data is created:
keystone.tests.unit.test_backend_rules.
RulesPolicy
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.TestCase
, keystone.tests.unit.policy.test_backends.PolicyTests
keystone.tests.unit.test_config.
DeprecatedOverrideTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.TestCase
Test using the deprecated AND new name for renamed options.
keystone.tests.unit.test_exception.
ExceptionTestCase
(*args, **kwargs)[source]¶keystone.tests.unit.test_exception.
SecurityErrorTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.test_exception.ExceptionTestCase
Test whether security-related info is exposed to the API user.
keystone.tests.unit.test_exception.
TestSecurityErrorTranslation
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test i18n for SecurityError exceptions.
CustomError
(message=None, **kwargs)[source]¶Bases: keystone.exception.Error
message_format
= 'We had a failure in the %(place)r'¶CustomSecurityError
(message=None, **kwargs)[source]¶Bases: keystone.exception.SecurityError
message_format
= 'We had a failure in the %(place)r'¶keystone.tests.unit.test_exception.
UnexpectedExceptionTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.test_exception.ExceptionTestCase
Test if internal info is exposed to the API user on UnexpectedError.
SubClassExc
(message=None, **kwargs)[source]¶Bases: keystone.exception.UnexpectedError
debug_message_format
= 'Debug Message: %(debug_info)s'¶keystone.tests.unit.test_shadow_users.
ShadowUsersTests
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.TestCase
, keystone.tests.unit.identity.shadow_users.test_backend.ShadowUsersBackendTests
, keystone.tests.unit.identity.shadow_users.test_core.ShadowUsersCoreTests
keystone.tests.unit.test_token_bind.
BindTest
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.TestCase
Test binding tokens to a Principal.
Even though everything in this file references kerberos the same concepts will apply to all future binding mechanisms.
keystone.tests.unit.test_url_middleware.
FakeApp
[source]¶Bases: object
Fakes a WSGI app URL normalized.
keystone.tests.unit.test_v2_controller.
TenantTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.TestCase
Test for the V2 Tenant controller.
These tests exercise keystone.assignment.controllers.Tenant
.
test_create_is_domain_project_fails
()[source]¶Test that the creation of a project acting as a domain fails.
test_create_project_passing_is_domain_false_fails
()[source]¶Test that passing is_domain=False is not allowed.
test_delete_is_domain_project_not_found
()[source]¶Test that delete is_domain project is not allowed in v2.
test_get_is_domain_project_not_found
()[source]¶Test that get project does not return is_domain projects.
test_get_project_users_no_user
()[source]¶Test the user’s existence for get_project_users.
When a user that’s not known to identity has a role on a project, then get_project_users just skips that user.
test_list_is_domain_project_not_found
()[source]¶Test v2 get_all_projects having projects that act as a domain.
In v2 no project with the is_domain flag enabled should be returned.
keystone.tests.unit.test_v2_validation.
RoleValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V2 Roles API Validation.
keystone.tests.unit.test_v2_validation.
ServiceValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V2 Service API Validation.
keystone.tests.unit.test_v2_validation.
TenantValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for v2 Tenant API Validation.
test_validate_tenant_create_fails_with_invalid_name
()[source]¶Exception when validating a create request with invalid name.
test_validate_tenant_create_with_invalid_enabled_fails
()[source]¶Exception is raised when enabled isn’t a boolean-like value.
test_validate_tenant_update_fails_with_invalid_name
()[source]¶Exception when validating an update request with invalid name.
keystone.tests.unit.test_v2_validation.
UserValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V2 User API Validation.
keystone.tests.unit.test_validation.
CredentialValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Credential API validation.
test_validate_credential_ec2_without_project_id_fails
()[source]¶Validate project_id is required for ec2.
Test that a SchemaValidationError is raised when type is ec2 and no project_id is provided in create request.
test_validate_credential_non_ec2_without_project_id_succeeds
()[source]¶Validate project_id is not required for non-ec2.
Test that create request without project_id succeeds for any non-ec2 credential.
test_validate_credential_update_succeeds
()[source]¶Test that a credential request is properly validated.
test_validate_credential_update_with_extra_parameters_succeeds
()[source]¶Validate credential update with extra parameters.
test_validate_credential_update_without_parameters_fails
()[source]¶Exception is raised on update without parameters.
test_validate_credential_with_extra_parameters_succeeds
()[source]¶Validate create request with extra parameters.
test_validate_credential_with_project_id_succeeds
()[source]¶Test that credential request works for all types.
test_validate_credential_without_blob_fails
()[source]¶Exception raised without blob in create request.
keystone.tests.unit.test_validation.
DomainValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Domain API validation.
test_validate_domain_create_fails_with_invalid_name
()[source]¶Exception when validating a create request with invalid name.
test_validate_domain_request_with_enabled
()[source]¶Validate enabled as boolean-like values for domains.
test_validate_domain_request_with_invalid_description_fails
()[source]¶Exception is raised when description is a non-string value.
test_validate_domain_request_with_invalid_enabled_fails
()[source]¶Exception is raised when enabled isn’t a boolean-like value.
test_validate_domain_request_with_name_too_long
()[source]¶Exception is raised when name is too long.
test_validate_domain_request_with_valid_description
()[source]¶Test that we validate description in create domain requests.
test_validate_domain_request_without_name_fails
()[source]¶Make sure we raise an exception when name isn’t included.
test_validate_domain_update_fails_with_invalid_name
()[source]¶Exception when validating an update request with invalid name.
keystone.tests.unit.test_validation.
EndpointGroupValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Endpoint Group API validation.
test_validate_create_endpoint_group_fails_with_invalid_filters
()[source]¶Validate invalid filters value in endpoint group parameters.
This test ensures that exception is raised when non-dict values is used as filters in endpoint group create request.
test_validate_endpoint_group_create_fails_without_filters
()[source]¶Exception raised when filters isn’t in endpoint group request.
test_validate_endpoint_group_create_fails_without_name
()[source]¶Exception raised when name isn’t in endpoint group request.
test_validate_endpoint_group_create_succeeds_with_req_parameters
()[source]¶Validate required endpoint group parameters.
This test ensure that validation succeeds with only the required parameters passed for creating an endpoint group.
test_validate_endpoint_group_create_succeeds_with_valid_filters
()[source]¶Validate filters in endpoint group create requests.
test_validate_endpoint_group_request_succeeds
()[source]¶Test that we validate an endpoint group request.
test_validate_endpoint_group_update_fails_with_invalid_filters
()[source]¶Exception raised when passing invalid filters in request.
test_validate_endpoint_group_update_fails_with_no_parameters
()[source]¶Exception raised when no parameters on endpoint group update.
test_validate_endpoint_group_update_request_succeeds
()[source]¶Test that we validate an endpoint group update request.
keystone.tests.unit.test_validation.
EndpointValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Endpoint API validation.
test_validate_create_endpoint_fails_with_invalid_enabled
()[source]¶Exception raised when boolean-like values as enabled.
test_validate_endpoint_create_fails_with_invalid_interface
()[source]¶Exception raised with invalid interface.
test_validate_endpoint_create_fails_with_invalid_region_id
()[source]¶Exception raised when passing invalid region(_id) in request.
test_validate_endpoint_create_fails_with_invalid_url
()[source]¶Exception raised when passing invalid url in request.
test_validate_endpoint_create_fails_without_interface
()[source]¶Exception raised when interface isn’t in endpoint request.
test_validate_endpoint_create_fails_without_service_id
()[source]¶Exception raised when service_id isn’t in endpoint request.
test_validate_endpoint_create_fails_without_url
()[source]¶Exception raised when url isn’t in endpoint request.
test_validate_endpoint_create_succeeds_with_extra_parameters
()[source]¶Test that extra parameters pass validation on create endpoint.
test_validate_endpoint_create_succeeds_with_required_parameters
()[source]¶Validate an endpoint request with only the required parameters.
test_validate_endpoint_create_succeeds_with_url
()[source]¶Validate url attribute in endpoint create request.
test_validate_endpoint_create_succeeds_with_valid_enabled
()[source]¶Validate an endpoint with boolean values.
Validate boolean values as enabled in endpoint create requests.
test_validate_endpoint_update_fails_with_invalid_enabled
()[source]¶Exception raised when enabled is boolean-like value.
test_validate_endpoint_update_fails_with_invalid_interface
()[source]¶Exception raised when invalid interface on endpoint update.
test_validate_endpoint_update_fails_with_invalid_region_id
()[source]¶Exception raised when passing invalid region(_id) in request.
test_validate_endpoint_update_fails_with_invalid_url
()[source]¶Exception raised when passing invalid url in request.
test_validate_endpoint_update_fails_with_no_parameters
()[source]¶Exception raised when no parameters on endpoint update.
test_validate_endpoint_update_request_succeeds
()[source]¶Test that we validate an endpoint update request.
test_validate_endpoint_update_succeeds_with_extra_parameters
()[source]¶Test that extra parameters pass validation on update endpoint.
keystone.tests.unit.test_validation.
EntityValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
test_create_entity_with_all_valid_parameters_validates
()[source]¶Validate all parameter values against test schema.
test_create_entity_with_invalid_email_fails
()[source]¶Validate invalid email address.
Test that an exception is raised when validating improperly formatted email addresses.
test_create_entity_with_invalid_enabled_format_raises_exception
()[source]¶Validate invalid enabled formats.
Test that an exception is raised when passing invalid boolean-like values as enabled.
test_create_entity_with_invalid_id_strings
()[source]¶Exception raised when using invalid id strings.
test_create_entity_with_invalid_urls_fails
()[source]¶Test that an exception is raised when validating improper urls.
test_create_entity_with_name_too_long_raises_exception
()[source]¶Validate long names.
Validate that an exception is raised when validating a string of 255+ characters passed in as a name.
test_create_entity_with_name_too_short_raises_exception
()[source]¶Validate short names.
Test that an exception is raised when passing a string of length zero as a name parameter.
test_create_entity_with_null_id_string
()[source]¶Validate that None is an acceptable optional string type.
test_create_entity_with_null_string_succeeds
()[source]¶Exception raised when passing None on required id strings.
test_create_entity_with_only_required_valid_parameters_validates
()[source]¶Validate correct for only parameters values against test schema.
test_create_entity_with_unicode_name_validates
()[source]¶Test that we successfully validate a unicode string.
test_create_entity_with_valid_email_validates
()[source]¶Validate email address.
Test that we successfully validate properly formatted email addresses.
test_create_entity_with_valid_enabled_formats_validates
()[source]¶Validate valid enabled formats.
Test that we have successful validation on boolean values for enabled.
test_create_entity_with_valid_urls_validates
()[source]¶Test that proper urls are successfully validated.
test_update_entity_with_a_null_optional_parameter_validates
()[source]¶Optional parameters can be null to removed the value.
test_update_entity_with_a_required_null_parameter_fails
()[source]¶The name parameter can’t be null.
test_update_entity_with_a_valid_optional_parameter_validates
()[source]¶Succeed with only a single valid optional parameter.
test_update_entity_with_a_valid_required_parameter_validates
()[source]¶Succeed if a valid required parameter is provided.
test_update_entity_with_all_parameters_valid_validates
()[source]¶Simulate updating an entity by ID.
test_update_entity_with_invalid_optional_parameter_fails
()[source]¶Fail when an optional parameter is invalid.
keystone.tests.unit.test_validation.
FederationProtocolValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Federation Protocol API validation.
test_validate_protocol_request_fails_with_invalid_mapping_id
()[source]¶Exception raised when mapping_id is not string.
test_validate_protocol_request_fails_with_invalid_params
()[source]¶Exception raised when unknown parameter is found.
test_validate_protocol_request_no_parameters
()[source]¶Test that schema validation with empty request body.
test_validate_protocol_request_succeeds
()[source]¶Test that we validate a protocol request successfully.
test_validate_protocol_request_succeeds_on_update
()[source]¶Test that we validate a protocol update request successfully.
test_validate_protocol_request_succeeds_with_nonuuid_mapping_id
()[source]¶Test that we allow underscore in mapping_id value.
test_validate_update_protocol_request_fails_with_invalid_id
()[source]¶Test that updating a protocol with a non-string mapping_id fail.
test_validate_update_protocol_request_fails_with_invalid_params
()[source]¶Exception raised when unknown parameter in protocol update.
keystone.tests.unit.test_validation.
GroupValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Group API validation.
test_validate_group_create_fails_with_invalid_name
()[source]¶Exception when validating a create request with invalid name.
test_validate_group_create_fails_without_group_name
()[source]¶Exception raised when group name is not provided in request.
test_validate_group_create_succeeds_with_all_parameters
()[source]¶Validate create group requests with all parameters.
test_validate_group_create_succeeds_with_extra_parameters
()[source]¶Validate extra attributes on group create requests.
test_validate_group_update_fails_with_invalid_name
()[source]¶Exception when validating an update request with invalid name.
keystone.tests.unit.test_validation.
IdentityProviderValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Identity Provider API validation.
test_validate_idp_request_fails_with_invalid_params
()[source]¶Exception raised when unknown parameter is found.
test_validate_idp_request_no_parameters
()[source]¶Test that schema validation with empty request body.
test_validate_idp_request_remote_id_nullable
()[source]¶Test that remote_ids could be explicitly set to None.
test_validate_idp_request_with_duplicated_remote_id
()[source]¶Exception is raised when the duplicated remote_ids is found.
test_validate_idp_request_with_invalid_description_fails
()[source]¶Exception is raised when description as a non-string value.
keystone.tests.unit.test_validation.
OAuth1ValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Identity OAuth1 API validation.
test_validate_consumer_request_succeeds
()[source]¶Test that we validate a consumer request successfully.
test_validate_consumer_request_with_invalid_description_fails
()[source]¶Exception is raised when description as a non-string value.
test_validate_consumer_request_with_no_parameters
()[source]¶Test that schema validation with empty request body.
keystone.tests.unit.test_validation.
PolicyValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Policy API validation.
test_validate_policy_create_with_extra_parameters_succeeds
()[source]¶Validate policy create with extra parameters.
test_validate_policy_create_with_invalid_type_fails
()[source]¶Exception raised when blob and type are boolean.
test_validate_policy_update_with_extra_parameters_succeeds
()[source]¶Validate policy update request with extra parameters.
test_validate_policy_update_with_invalid_type_fails
()[source]¶Exception raised when invalid type on policy update.
keystone.tests.unit.test_validation.
ProjectValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Project API validation.
test_validate_project_create_fails_with_invalid_name
()[source]¶Exception when validating a create request with invalid name.
test_validate_project_create_request_with_valid_domain_id
()[source]¶Test that we validate domain_id in create project requests.
test_validate_project_request_with_enabled
()[source]¶Validate enabled as boolean-like values for projects.
test_validate_project_request_with_invalid_description_fails
()[source]¶Exception is raised when description as a non-string value.
test_validate_project_request_with_invalid_domain_id_fails
()[source]¶Exception is raised when domain_id is a non-id value.
test_validate_project_request_with_invalid_enabled_fails
()[source]¶Exception is raised when enabled isn’t a boolean-like value.
test_validate_project_request_with_invalid_parent_id_fails
()[source]¶Exception is raised when parent_id as a non-id value.
test_validate_project_request_with_name_too_long
()[source]¶Exception is raised when name is too long.
test_validate_project_request_with_valid_description
()[source]¶Test that we validate description in create project requests.
test_validate_project_request_with_valid_parent_id
()[source]¶Test that we validate parent_id in create project requests.
test_validate_project_request_without_name_fails
()[source]¶Validate project request fails without name.
test_validate_project_update_fails_with_invalid_name
()[source]¶Exception when validating an update request with invalid name.
keystone.tests.unit.test_validation.
RegionValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Region API validation.
test_validate_region_create_fails_with_invalid_region_id
()[source]¶Exception raised when passing invalid id in request.
test_validate_region_create_request_with_parameters
()[source]¶Test that we validate a region request with parameters.
test_validate_region_create_succeeds_with_extra_parameters
()[source]¶Validate create region request with extra values.
test_validate_region_create_succeeds_with_no_parameters
()[source]¶Validate create region request with no parameters.
test_validate_region_create_with_uuid
()[source]¶Test that we validate a region request with a UUID as the id.
keystone.tests.unit.test_validation.
RoleValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Role API validation.
test_validate_role_create_fails_with_invalid_name
()[source]¶Exception when validating a create request with invalid name.
test_validate_role_create_request_with_name_too_long_fails
()[source]¶Exception raised when creating a role with name too long.
test_validate_role_create_without_name_raises_exception
()[source]¶Test that we raise an exception when name isn’t included.
keystone.tests.unit.test_validation.
ServiceProviderValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Service Provider API validation.
test_validate_sp_request_with_extra_field_fails
()[source]¶Exception raised when passing extra fields in the body.
test_validate_sp_request_with_invalid_auth_url_fails
()[source]¶Validate request fails with invalid auth_url.
test_validate_sp_request_with_invalid_description_fails
()[source]¶Exception is raised when description as a non-string value.
test_validate_sp_request_with_invalid_enabled_fails
()[source]¶Exception is raised when enabled isn’t a boolean-like value.
test_validate_sp_request_with_invalid_sp_url_fails
()[source]¶Validate request fails with invalid sp_url.
test_validate_sp_request_with_valid_description
()[source]¶Test that we validate description in create requests.
test_validate_sp_update_request_with_invalid_auth_url_fails
()[source]¶Exception raised when updating with invalid auth_url.
keystone.tests.unit.test_validation.
ServiceValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Service API validation.
test_validate_service_create_fails_when_name_too_long
()[source]¶Exception raised when name is greater than 255 characters.
test_validate_service_create_fails_when_name_too_short
()[source]¶Exception is raised when name is too short.
test_validate_service_create_fails_when_type_too_long
()[source]¶Exception is raised when type is too long.
test_validate_service_create_fails_when_type_too_short
()[source]¶Exception is raised when type is too short.
test_validate_service_create_fails_with_invalid_enabled
()[source]¶Exception raised when boolean-like parameters as enabled.
On service create, make sure an exception is raised if enabled is not a boolean value.
test_validate_service_create_fails_without_type
()[source]¶Exception raised when trying to create a service without type.
test_validate_service_create_succeeds_with_extra_parameters
()[source]¶Test that extra parameters pass validation on create service.
test_validate_service_create_succeeds_with_required_parameters
()[source]¶Validate a service create request with the required parameters.
test_validate_service_create_succeeds_with_valid_enabled
()[source]¶Validate boolean values as enabled values on service create.
test_validate_service_update_fails_with_invalid_enabled
()[source]¶Exception raised when boolean-like values as enabled.
test_validate_service_update_fails_with_name_too_long
()[source]¶Exception is raised when name is too long on update.
test_validate_service_update_fails_with_name_too_short
()[source]¶Exception is raised when name is too short on update.
test_validate_service_update_fails_with_no_parameters
()[source]¶Exception raised when updating a service without values.
test_validate_service_update_fails_with_type_too_long
()[source]¶Exception is raised when type is too long on update.
test_validate_service_update_fails_with_type_too_short
()[source]¶Exception is raised when type is too short on update.
test_validate_service_update_request_succeeds
()[source]¶Test that we validate a service update request.
keystone.tests.unit.test_validation.
TrustValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 Trust API validation.
test_validate_trust_with_all_parameters_succeeds
()[source]¶Test that we can validate a trust request with all parameters.
test_validate_trust_with_extra_parameters_succeeds
()[source]¶Test that we can validate a trust request with extra parameters.
test_validate_trust_with_invalid_expires_at_fails
()[source]¶Validate trust request with invalid expires_at fails.
test_validate_trust_with_invalid_impersonation_fails
()[source]¶Validate trust request with invalid impersonation fails.
test_validate_trust_with_invalid_role_type_fails
()[source]¶Validate trust request with invalid roles fails.
test_validate_trust_with_list_of_valid_roles_succeeds
()[source]¶Validate trust request with a list of valid roles.
test_validate_trust_with_null_remaining_uses_succeeds
()[source]¶Validate trust request with null remaining_uses.
test_validate_trust_with_period_in_user_id_string
()[source]¶Validate trust request with a period in the user id string.
test_validate_trust_with_remaining_uses_succeeds
()[source]¶Validate trust request with remaining_uses succeeds.
test_validate_trust_without_impersonation_fails
()[source]¶Validate trust request fails without impersonation.
keystone.tests.unit.test_validation.
UserValidationTestCase
(*args, **kwargs)[source]¶Bases: keystone.tests.unit.core.BaseTestCase
Test for V3 User API validation.
test_validate_user_create_fails_with_invalid_enabled_formats
()[source]¶Exception raised when enabled is not an acceptable format.
test_validate_user_create_fails_with_invalid_name
()[source]¶Exception when validating a create request with invalid name.
test_validate_user_create_fails_with_invalid_password_type
()[source]¶Exception raised when user password is of the wrong type.
test_validate_user_create_fails_without_name
()[source]¶Exception raised when validating a user without name.
test_validate_user_create_request_succeeds
()[source]¶Test that validating a user create request succeeds.
test_validate_user_create_succeeds_with_extra_attributes
()[source]¶Validate extra parameters on user create requests.
test_validate_user_create_succeeds_with_null_description
()[source]¶Validate that description can be nullable on create user.
test_validate_user_create_succeeds_with_null_password
()[source]¶Validate that password is nullable on create user.
test_validate_user_create_succeeds_with_password_of_zero_length
()[source]¶Validate empty password on user create requests.
test_validate_user_create_succeeds_with_valid_enabled_formats
()[source]¶Validate acceptable enabled formats in create user requests.
test_validate_user_create_with_all_valid_parameters_succeeds
()[source]¶Test that validating a user create request succeeds.
test_validate_user_update_fails_with_invalid_name
()[source]¶Exception when validating an update request with invalid name.
Useful utilities for tests.
keystone.tests.unit.utils.
wip
(message, expected_exception=<type 'exceptions.Exception'>, bug=None)[source]¶Mark a test as work in progress.
Based on code by Nat Pryce: https://gist.github.com/npryce/997195#file-wip-py
The test will always be run. If the test fails then a TestSkipped exception is raised. If the test passes an AssertionError exception is raised so that the developer knows they made the test pass. This is a reminder to remove the decorator.
Parameters: |
|
---|
>>> @wip('Expected Error', expected_exception=Exception, bug="#000000")
>>> def test():
>>> pass
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.