keystone.tests.unit package

Subpackages

Submodules

keystone.tests.unit.core module

class 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.

cleanup_instance(*names)[source]

Create a function suitable for use with self.addCleanup.

Returns:a callable that uses a closure to delete instance attributes
setUp()[source]
skip_if_env_not_set(env_var)[source]
skip_test_overrides(*args, **kwargs)[source]
class keystone.tests.unit.core.EggLoader(spec)[source]

Bases: paste.deploy.loadwsgi.EggLoader

find_egg_entry_point(object_type, name=None)[source]
class keystone.tests.unit.core.SQLDriverOverrides[source]

Bases: object

A mixin for consolidating sql-specific test overrides.

config_overrides()[source]
use_specific_sql_driver_version(driver_path, versionless_backend, version_suffix)[source]

Add this versioned driver to the list that will be loaded.

Parameters:
  • driver_path – The path to the drivers, e.g. ‘keystone.assignment’
  • versionless_backend – The name of the versionless drivers, e.g. ‘backends’
  • version_suffix – The suffix for the version , e.g. V8_

This method assumes that versioned drivers are named: <version_suffix><name of versionless driver>, e.g. ‘V8_backends’.

class 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.
assertNotEmpty(l)[source]
assertRaisesRegexp(expected_exception, expected_regexp, callable_obj, *args, **kwargs)[source]

Assert that the message in a raised exception matches a regexp.

assertTimestampEqual(expected, value)[source]
config(config_files)[source]
config_files()[source]
config_overrides()[source]
ipv6_enabled[source]
load_backends()[source]

Initialize each manager and assigns them to an attribute.

load_fixtures(fixtures)[source]

Hacky basic and naive fixture loading based on a python module.

Expects that the various APIs into the various services are already defined on self.

loadapp(config, name='main')[source]
make_request(path='/', **kwargs)[source]
setUp()[source]
skip_if_no_ipv6()[source]
exception keystone.tests.unit.core.UnexpectedExit[source]

Bases: exceptions.Exception

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.

class keystone.tests.unit.core.dirs[source]

Bases: object

static etc(*p)[source]
static root(*p)[source]
static tests(*p)[source]
static tests_conf(*p)[source]
static tmp(*p)[source]
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_domain_ref(**kwargs)[source]
keystone.tests.unit.core.new_ec2_credential(user_id, project_id=None, blob=None, **kwargs)[source]
keystone.tests.unit.core.new_endpoint_ref(service_id, interface='public', region_id=<object object at 0xd230140>, **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_federated_user_ref(idp_id=None, protocol_id=None, **kwargs)[source]
keystone.tests.unit.core.new_group_ref(domain_id, **kwargs)[source]
keystone.tests.unit.core.new_policy_ref(**kwargs)[source]
keystone.tests.unit.core.new_project_ref(domain_id=None, is_domain=False, **kwargs)[source]
keystone.tests.unit.core.new_region_ref(parent_region_id=None, **kwargs)[source]
keystone.tests.unit.core.new_role_ref(**kwargs)[source]
keystone.tests.unit.core.new_service_ref(**kwargs)[source]
keystone.tests.unit.core.new_totp_credential(user_id, project_id=None, blob=None)[source]
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.new_user_ref(domain_id, project_id=None, **kwargs)[source]
keystone.tests.unit.core.remove_test_databases()[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.

keystone.tests.unit.core.skip_if_cache_is_enabled(*sections)[source]
keystone.tests.unit.core.skip_if_no_multiple_domains_support(f)[source]

Decorator to skip tests for identity drivers limited to one domain.

keystone.tests.unit.default_fixtures module

keystone.tests.unit.fakeldap module

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.

class 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.

add_s(dn, modlist)[source]

Add an object with the specified attributes at dn.

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)[source]
delete_ext_s(dn, serverctrls, clientctrls=None)[source]

Remove the ldap object at specified dn.

delete_s(dn)[source]

Remove the ldap object at specified dn.

dn(dn)[source]
get_option(option)[source]
key(dn)[source]
modify_s(dn, modlist)[source]

Modify the object at dn using the attribute list.

Parameters:
  • dn – an LDAP DN
  • modlist – a list of tuples in the following form: ([MOD_ADD | MOD_DELETE | MOD_REPACE], attribute, value)
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

set_option(option, invalue)[source]
simple_bind_s(who='', cred='', serverctrls=None, clientctrls=None)[source]

Provide for compatibility but this method is ignored.

unbind_s()[source]

Provide for compatibility but this method is ignored.

class 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.

delete_ext_s(dn, serverctrls, clientctrls=None)[source]

Remove the ldap object at specified dn.

class 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.

get_lifetime()[source]
simple_bind_s(who=None, cred=None, serverctrls=None, clientctrls=None)[source]
unbind_ext_s()[source]

Added to extend FakeLdap as connector class.

class keystone.tests.unit.fakeldap.FakeShelve[source]

Bases: dict

sync()[source]

keystone.tests.unit.federation_fixtures module

keystone.tests.unit.filtering module

class keystone.tests.unit.filtering.FilterTests[source]

Bases: object

keystone.tests.unit.identity_mapping module

keystone.tests.unit.identity_mapping.list_id_mappings()[source]

List all id_mappings for testing purposes.

keystone.tests.unit.mapping_fixtures module

Fixtures for Federation Mapping.

keystone.tests.unit.rest module

keystone.tests.unit.test_associate_project_endpoint_extension module

keystone.tests.unit.test_auth module

keystone.tests.unit.test_auth_plugin module

keystone.tests.unit.test_backend_endpoint_policy module

class 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:

  • 3 regions, in a hierarchy, 0 -> 1 -> 2 (where 0 is top)
  • 3 services
  • 6 endpoints, 2 in each region, with a mixture of services: 0 - region 0, Service 0 1 - region 0, Service 1 2 - region 1, Service 1 3 - region 1, Service 2 4 - region 2, Service 2 5 - region 2, Service 0
test_delete_association_by_entity()[source]
test_invalid_policy_to_endpoint_association()[source]
test_overwriting_policy_to_endpoint_association()[source]
test_policy_to_endpoint_association_crud()[source]
test_policy_to_explicit_endpoint_association()[source]
test_policy_to_region_and_service_association()[source]
test_policy_to_service_association()[source]

keystone.tests.unit.test_backend_endpoint_policy_sql module

keystone.tests.unit.test_backend_federation_sql module

keystone.tests.unit.test_backend_id_mapping_sql module

keystone.tests.unit.test_backend_kvs module

class keystone.tests.unit.test_backend_kvs.KvsToken(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase, keystone.tests.unit.token.test_backends.TokenTests

config_overrides()[source]
setUp()[source]
test_cleanup_user_index_on_create()[source]
test_flush_expired_token()[source]
class keystone.tests.unit.test_backend_kvs.KvsTokenCacheInvalidation(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase, keystone.tests.unit.token.test_backends.TokenCacheInvalidation

config_overrides()[source]
setUp()[source]

keystone.tests.unit.test_backend_ldap module

keystone.tests.unit.test_backend_ldap_pool module

keystone.tests.unit.test_backend_rules module

class keystone.tests.unit.test_backend_rules.RulesPolicy(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase, keystone.tests.unit.policy.test_backends.PolicyTests

config_overrides()[source]
setUp()[source]
test_create()[source]
test_delete()[source]
test_delete_policy_returns_not_found()[source]
test_get()[source]
test_get_policy_returns_not_found()[source]
test_list()[source]
test_update()[source]
test_update_policy_returns_not_found()[source]

keystone.tests.unit.test_backend_sql module

keystone.tests.unit.test_backend_templated module

keystone.tests.unit.test_catalog module

keystone.tests.unit.test_cert_setup module

keystone.tests.unit.test_cli module

keystone.tests.unit.test_config module

class keystone.tests.unit.test_config.ConfigTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

config_files()[source]
test_config_default()[source]
test_paste_config()[source]
test_profiler_config_default()[source]

Check config.set_config_defaults() has set [profiler]enabled.

class 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.

config_files()[source]
test_sql()[source]
class keystone.tests.unit.test_config.DeprecatedTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

Test using the original (deprecated) name for renamed options.

config_files()[source]
test_sql()[source]

keystone.tests.unit.test_contrib_s3_core module

class keystone.tests.unit.test_contrib_s3_core.S3ContribCore(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

setUp()[source]
test_bad_signature_v1()[source]
test_bad_signature_v4()[source]
test_bad_token_v4()[source]
test_good_signature_v1()[source]
test_good_signature_v4()[source]

keystone.tests.unit.test_contrib_simple_cert module

keystone.tests.unit.test_credential module

keystone.tests.unit.test_driver_hints module

class keystone.tests.unit.test_driver_hints.ListHintsTests(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

test_create_iterate_satisfy()[source]
test_limits()[source]
test_multiple_creates()[source]

keystone.tests.unit.test_entry_points module

class keystone.tests.unit.test_entry_points.TestPasteDeploymentEntryPoints(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

test_entry_point_middleware()[source]

Assert that our list of expected middleware is present.

keystone.tests.unit.test_exception module

class keystone.tests.unit.test_exception.ExceptionTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

assertValidJsonRendering(e)[source]
test_all_json_renderings()[source]

Everything callable in the exception module should be renderable.

... except for the base error class (exception.Error), which is not user-facing.

This test provides a custom message to bypass docstring parsing, which should be tested separately.

test_forbidden_title()[source]
test_invalid_unicode_string()[source]
test_not_found()[source]
test_unicode_message()[source]
test_unicode_string()[source]
test_validation_error()[source]
class 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.

setUp()[source]
test_forbidden_action_exposure()[source]
test_forbidden_action_exposure_in_debug()[source]
test_forbidden_action_no_message()[source]
test_forbidden_exposure()[source]
test_forbidden_exposure_in_debug()[source]
test_unauthorized_exposure()[source]
test_unauthorized_exposure_in_debug()[source]
test_unicode_argument_message()[source]
class keystone.tests.unit.test_exception.TestSecurityErrorTranslation(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test i18n for SecurityError exceptions.

exception CustomError(message=None, **kwargs)[source]

Bases: keystone.exception.Error

message_format = u'We had a failure in the %(place)r'
exception TestSecurityErrorTranslation.CustomSecurityError(message=None, **kwargs)[source]

Bases: keystone.exception.SecurityError

message_format = u'We had a failure in the %(place)r'
TestSecurityErrorTranslation.setUp()[source]
TestSecurityErrorTranslation.test_nested_translation_of_SecurityErrors()[source]
TestSecurityErrorTranslation.test_that_regular_Errors_can_be_deep_copied()[source]
class 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.

exception SubClassExc(message=None, **kwargs)[source]

Bases: keystone.exception.UnexpectedError

debug_message_format = 'Debug Message: %(debug_info)s'
UnexpectedExceptionTestCase.setUp()[source]
UnexpectedExceptionTestCase.test_unexpected_error_custom_message_binary_debug()[source]
UnexpectedExceptionTestCase.test_unexpected_error_custom_message_debug()[source]
UnexpectedExceptionTestCase.test_unexpected_error_custom_message_exception_debug()[source]
UnexpectedExceptionTestCase.test_unexpected_error_custom_message_no_debug()[source]
UnexpectedExceptionTestCase.test_unexpected_error_debug()[source]
UnexpectedExceptionTestCase.test_unexpected_error_no_debug()[source]
UnexpectedExceptionTestCase.test_unexpected_error_subclass_debug()[source]
UnexpectedExceptionTestCase.test_unexpected_error_subclass_no_debug()[source]

keystone.tests.unit.test_hacking_checks module

keystone.tests.unit.test_kvs module

keystone.tests.unit.test_ldap_livetest module

keystone.tests.unit.test_ldap_pool_livetest module

keystone.tests.unit.test_ldap_tls_livetest module

keystone.tests.unit.test_middleware module

keystone.tests.unit.test_no_admin_token_auth module

keystone.tests.unit.test_policy module

class keystone.tests.unit.test_policy.DefaultPolicyTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

setUp()[source]
test_default_not_found()[source]
test_not_found_policy_calls_default()[source]
test_policy_called()[source]
class keystone.tests.unit.test_policy.PolicyFileTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

setUp()[source]
test_modified_policy_reloads()[source]
class keystone.tests.unit.test_policy.PolicyJsonTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

test_all_targets_documented()[source]
test_json_examples_have_matching_entries()[source]
class keystone.tests.unit.test_policy.PolicyTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

setUp()[source]
test_early_AND_enforcement()[source]
test_early_OR_enforcement()[source]
test_enforce_bad_action_throws()[source]
test_enforce_good_action()[source]
test_enforce_nonexistent_action_throws()[source]
test_ignore_case_role_check()[source]
test_templatized_enforcement()[source]

keystone.tests.unit.test_revoke module

keystone.tests.unit.test_sql_banned_operations module

keystone.tests.unit.test_sql_upgrade module

keystone.tests.unit.test_token_bind module

class 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.

assert_kerberos_bind(tokens, bind_level, use_kerberos=True, success=True)[source]
setUp()[source]
test_bind_disabled_with_kerb_user()[source]
test_bind_named_with_kerb_user()[source]
test_bind_named_with_regular_token()[source]
test_bind_named_with_unknown_bind()[source]
test_bind_named_with_unknown_scheme()[source]
test_bind_named_without_kerb_user()[source]
test_bind_permissive_with_kerb_user()[source]
test_bind_permissive_with_regular_token()[source]
test_bind_permissive_with_unknown_bind()[source]
test_bind_permissive_without_kerb_user()[source]
test_bind_required_with_kerb_user()[source]
test_bind_required_with_regular_token()[source]
test_bind_required_with_unknown_bind()[source]
test_bind_required_without_kerb_user()[source]
test_bind_strict_with_kerb_user()[source]
test_bind_strict_with_regular_token()[source]
test_bind_strict_with_unknown_bind()[source]
test_bind_strict_without_kerb_user()[source]

keystone.tests.unit.test_token_provider module

class keystone.tests.unit.test_token_provider.PKIProviderTests[source]

Bases: object

setUp()[source]
test_get_token_id_error_handling()[source]
class keystone.tests.unit.test_token_provider.TestPKIProviderWithStdlib(*args, **kwargs)[source]

Bases: keystone.tests.unit.test_token_provider.PKIProviderTests, keystone.tests.unit.core.TestCase

setUp()[source]
class keystone.tests.unit.test_token_provider.TestTokenProvider(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

setUp()[source]
test_get_token_version()[source]
test_no_token_raises_token_not_found()[source]
test_provider_token_expiration_validation()[source]
test_supported_token_providers()[source]
test_unsupported_token_provider()[source]
keystone.tests.unit.test_token_provider.create_v2_token()[source]
keystone.tests.unit.test_token_provider.create_v3_token()[source]

keystone.tests.unit.test_url_middleware module

class keystone.tests.unit.test_url_middleware.FakeApp[source]

Bases: object

Fakes a WSGI app URL normalized.

class keystone.tests.unit.test_url_middleware.UrlMiddlewareTest(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

setUp()[source]
start_fake_response(status, headers)[source]
test_rewrite_empty_path()[source]

Test empty path is rewritten to root.

test_trailing_slash_normalization()[source]

Test /v2.0/tokens and /v2.0/tokens/ normalized URLs match.

keystone.tests.unit.test_v2 module

keystone.tests.unit.test_v2_controller module

class 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.

setUp()[source]
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.

test_list_projects_default_domain()[source]

Test that list projects only returns those in the default domain.

test_update_is_domain_project_not_found()[source]

Test that update is_domain project is not allowed in v2.

keystone.tests.unit.test_v2_validation module

class keystone.tests.unit.test_v2_validation.RoleValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V2 Roles API Validation.

setUp()[source]
test_validate_role_create_fails_with_invalid_name()[source]

Exception when validating a create request with invalid name.

test_validate_role_create_fails_with_invalid_params()[source]
test_validate_role_create_fails_with_no_params()[source]
test_validate_role_create_succeeds()[source]
test_validate_role_create_succeeds_with_extra_params()[source]
class keystone.tests.unit.test_v2_validation.ServiceValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V2 Service API Validation.

setUp()[source]
test_validate_service_create_fails_with_invalid_name()[source]
test_validate_service_create_fails_with_invalid_params()[source]
test_validate_service_create_succeeds()[source]
test_validate_service_create_with_enabled()[source]

Validate enabled as boolean-like values.

test_validate_service_create_with_invalid_enabled_fails()[source]

Exception is raised when enabled isn’t a boolean-like value.

test_validate_service_create_with_invalid_type()[source]
test_validate_service_create_with_type_too_large()[source]
class keystone.tests.unit.test_v2_validation.TenantValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for v2 Tenant API Validation.

setUp()[source]
test_validate_tenant_create_fails_with_invalid_name()[source]

Exception when validating a create request with invalid name.

test_validate_tenant_create_failure_with_empty_request()[source]
test_validate_tenant_create_failure_with_is_domain()[source]
test_validate_tenant_create_failure_with_missing_name()[source]
test_validate_tenant_create_success()[source]
test_validate_tenant_create_success_with_empty_description()[source]
test_validate_tenant_create_success_with_extra_parameters()[source]
test_validate_tenant_create_with_enabled()[source]

Validate enabled as boolean-like values.

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.

test_validate_tenant_update_success()[source]
test_validate_tenant_update_success_with_optional_ids()[source]
test_validate_tenant_update_with_domain_id()[source]
test_validate_tenant_update_with_empty_request()[source]
test_validate_tenant_update_with_enabled()[source]

Validate enabled as boolean-like values.

test_validate_tenant_update_with_invalid_enabled_fails()[source]

Exception is raised when enabled isn’t a boolean-like value.

test_validate_tenant_update_with_is_domain()[source]
class keystone.tests.unit.test_v2_validation.UserValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V2 User API Validation.

setUp()[source]
test_validate_user_create_fails_with_invalid_name()[source]
test_validate_user_create_fails_with_invalid_params()[source]
test_validate_user_create_succeeds_with_name()[source]
test_validate_user_create_succeeds_with_username()[source]
test_validate_user_create_with_enabled()[source]

Validate enabled as boolean-like values.

test_validate_user_create_with_invalid_enabled_fails()[source]

Exception is raised when enabled isn’t a boolean-like value.

test_validate_user_update_fails_with_invalid_name()[source]
test_validate_user_update_succeeds_with_name()[source]
test_validate_user_update_succeeds_with_no_params()[source]
test_validate_user_update_succeeds_with_username()[source]
test_validate_user_update_with_enabled()[source]

Validate enabled as boolean-like values.

test_validate_user_update_with_invalid_enabled_fails()[source]

Exception is raised when enabled isn’t a boolean-like value.

keystone.tests.unit.test_v3 module

keystone.tests.unit.test_v3_assignment module

keystone.tests.unit.test_v3_auth module

keystone.tests.unit.test_v3_catalog module

keystone.tests.unit.test_v3_credential module

keystone.tests.unit.test_v3_domain_config module

keystone.tests.unit.test_v3_endpoint_policy module

keystone.tests.unit.test_v3_federation module

keystone.tests.unit.test_v3_filters module

keystone.tests.unit.test_v3_identity module

keystone.tests.unit.test_v3_oauth1 module

keystone.tests.unit.test_v3_os_revoke module

keystone.tests.unit.test_v3_policy module

keystone.tests.unit.test_v3_protection module

keystone.tests.unit.test_v3_resource module

keystone.tests.unit.test_v3_trust module

keystone.tests.unit.test_validation module

class keystone.tests.unit.test_validation.CredentialValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Credential API validation.

setUp()[source]
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_succeeds()[source]

Test that we validate a credential request.

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.

test_validate_credential_without_type_fails()[source]

Exception raised without type in create request.

test_validate_credential_without_user_id_fails()[source]

Exception raised without user_id in create request.

class keystone.tests.unit.test_validation.DomainValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Domain API validation.

setUp()[source]
test_validate_domain_create_fails_with_invalid_name()[source]

Exception when validating a create request with invalid name.

test_validate_domain_request()[source]

Make sure we successfully validate a create domain request.

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.

test_validate_domain_update_request()[source]

Test that we validate a domain update request.

test_validate_domain_update_request_with_name_too_long_fails()[source]

Exception raised when updating a domain with name too long.

test_validate_domain_update_request_with_no_parameters_fails()[source]

Exception is raised when updating a domain without parameters.

class keystone.tests.unit.test_validation.EndpointGroupValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Endpoint Group API validation.

setUp()[source]
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.

test_validate_endpoint_group_update_succeeds_with_name()[source]

Validate request with only name in endpoint group update.

This test ensures that passing only a name passes validation on update endpoint group request.

test_validate_endpoint_group_update_succeeds_with_valid_filters()[source]

Validate filters as dict values.

class keystone.tests.unit.test_validation.EndpointValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Endpoint API validation.

setUp()[source]
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_request_succeeds()[source]

Test that we validate an endpoint request.

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.

test_validate_endpoint_update_succeeds_with_url()[source]

Validate url attribute in endpoint update request.

test_validate_endpoint_update_succeeds_with_valid_enabled()[source]

Validate enabled as boolean values.

class keystone.tests.unit.test_validation.EntityValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

setUp()[source]
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_id_strings()[source]

Validate acceptable id strings.

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.

test_update_entity_with_invalid_required_parameter_fails()[source]

Fail if a provided required parameter is invalid.

test_update_entity_with_no_parameters_fails()[source]

At least one parameter needs to be present for an update.

class keystone.tests.unit.test_validation.FederationProtocolValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Federation Protocol API validation.

setUp()[source]
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.

test_validate_update_protocol_request_succeeds_with_nonuuid_id()[source]

Test that we allow underscore in mapping_id value when updating.

test_validate_update_protocol_with_no_parameters_fails()[source]

Test that updating a protocol requires at least one attribute.

class keystone.tests.unit.test_validation.GroupValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Group API validation.

setUp()[source]
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()[source]

Validate create group requests.

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.

test_validate_group_update_fails_with_no_parameters()[source]

Exception raised when no parameters passed in on update.

test_validate_group_update_succeeds()[source]

Validate group update requests.

test_validate_group_update_succeeds_with_extra_parameters()[source]

Validate group update requests with extra parameters.

class keystone.tests.unit.test_validation.IdentityProviderValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Identity Provider API validation.

setUp()[source]
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_succeeds()[source]

Test that we validate an identity provider request.

test_validate_idp_request_with_duplicated_remote_id()[source]

Exception is raised when the duplicated remote_ids is found.

test_validate_idp_request_with_enabled()[source]

Validate enabled as boolean-like values.

test_validate_idp_request_with_invalid_description_fails()[source]

Exception is raised when description as a non-string value.

test_validate_idp_request_with_invalid_enabled_fails()[source]

Exception is raised when enabled isn’t a boolean-like value.

test_validate_idp_request_with_invalid_remote_id_fails()[source]

Exception is raised when remote_ids is not a array.

class keystone.tests.unit.test_validation.OAuth1ValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Identity OAuth1 API validation.

setUp()[source]
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.

test_validate_consumer_request_with_none_desc()[source]

Test that schema validation with None desc.

test_validate_update_consumer_request_fails_with_secret()[source]

Exception raised when secret is given.

class keystone.tests.unit.test_validation.PasswordValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

setUp()[source]
test_password_validate_with_invalid_password_regex()[source]
test_password_validate_with_invalid_strong_password()[source]
test_password_validate_with_valid_strong_password()[source]
class keystone.tests.unit.test_validation.PolicyValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Policy API validation.

setUp()[source]
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_succeeds()[source]

Test that we validate a create policy request.

test_validate_policy_update_succeeds()[source]

Test that we validate a policy update request.

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.

test_validate_policy_update_without_parameters_fails()[source]

Exception raised when updating policy without parameters.

test_validate_policy_without_blob_fails()[source]

Exception raised without blob in request.

test_validate_policy_without_type_fails()[source]

Exception raised without type in request.

class keystone.tests.unit.test_validation.ProjectValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Project API validation.

setUp()[source]
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()[source]

Test that we validate a project with name in request.

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.

test_validate_project_update_request()[source]

Test that we validate a project update request.

test_validate_project_update_request_with_name_too_long_fails()[source]

Exception raised when updating a project with name too long.

test_validate_project_update_request_with_no_parameters_fails()[source]

Exception is raised when updating project without parameters.

class keystone.tests.unit.test_validation.RegionValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Region API validation.

setUp()[source]
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.

test_validate_region_request()[source]

Test that we validate a basic region request.

test_validate_region_update_fails_with_no_parameters()[source]

Exception raised when passing no parameters in a region update.

test_validate_region_update_succeeds()[source]

Test that we validate a region update request.

test_validate_region_update_succeeds_with_extra_parameters()[source]

Validate extra attributes in the region update request.

class keystone.tests.unit.test_validation.RoleValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Role API validation.

setUp()[source]
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.

test_validate_role_request()[source]

Test we can successfully validate a create role request.

test_validate_role_update_fails_with_invalid_name()[source]

Exception when validating an update request with invalid name.

test_validate_role_update_request()[source]

Test that we validate a role update request.

test_validate_role_update_request_with_name_too_long_fails()[source]

Exception raised when updating a role with name too long.

class keystone.tests.unit.test_validation.ServiceProviderValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Service Provider API validation.

setUp()[source]
test_validate_sp_request()[source]

Test that we validate auth_url and sp_url in request.

test_validate_sp_request_with_enabled()[source]

Validate enabled as boolean-like values.

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_request_without_auth_url_fails()[source]

Validate request fails without auth_url.

test_validate_sp_request_without_sp_url_fails()[source]

Validate request fails without sp_url.

test_validate_sp_update_request()[source]

Test that we validate a update request.

test_validate_sp_update_request_with_invalid_auth_url_fails()[source]

Exception raised when updating with invalid auth_url.

test_validate_sp_update_request_with_invalid_sp_url_fails()[source]

Exception raised when updating with invalid sp_url.

test_validate_sp_update_request_with_no_parameters_fails()[source]

Exception is raised when updating without parameters.

class keystone.tests.unit.test_validation.ServiceValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Service API validation.

setUp()[source]
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()[source]

Test that we validate a service create request.

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.

test_validate_service_update_succeeds_with_extra_parameters()[source]

Validate updating a service with extra parameters.

test_validate_service_update_succeeds_with_valid_enabled()[source]

Validate boolean formats as enabled on service update.

class keystone.tests.unit.test_validation.TrustValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 Trust API validation.

setUp()[source]
test_validate_trust_succeeds()[source]

Test that we can validate a trust request.

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_with_role_types_succeeds()[source]

Validate trust request with roles succeeds.

test_validate_trust_without_impersonation_fails()[source]

Validate trust request fails without impersonation.

test_validate_trust_without_trustee_id_fails()[source]

Validate trust request fails without trustee_id.

test_validate_trust_without_trustor_id_fails()[source]

Validate trust request fails without trustor_id.

class keystone.tests.unit.test_validation.UserValidationTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

Test for V3 User API validation.

setUp()[source]
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.

test_validate_user_update_fails_with_no_parameters()[source]

Exception raised when updating nothing.

test_validate_user_update_succeeds()[source]

Validate an update user request.

test_validate_user_update_succeeds_with_extra_parameters()[source]

Validate user update requests with extra parameters.

keystone.tests.unit.test_validation.expected_validation_failure(msg)[source]

keystone.tests.unit.test_versions module

keystone.tests.unit.test_wsgi module

keystone.tests.unit.utils module

Useful utilities for tests.

keystone.tests.unit.utils.new_uuid()[source]

Return a string UUID.

keystone.tests.unit.utils.timezone(func)[source]
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:
  • message – a string message to help clarify why the test is marked as a work in progress
  • expected_exception – an exception class that will be checked for when @wip verifies an exception is raised. The test will fail if a different exception is raised. Default is “any” exception is valid
  • bug – (optional) a string for tracking the bug and what bug should cause the @wip decorator to be removed from the testcase
Usage:
>>> @wip('Expected Error', expected_exception=Exception, bug="#000000")
>>> def test():
>>>     pass

Module contents

Table Of Contents

This Page