keystone.tests.unit.common package

Submodules

keystone.tests.unit.common.test_cache module

class keystone.tests.unit.common.test_cache.TestCacheRegion(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_combination()[source]
test_direct_region_key_invalidation()[source]

Invalidate by manually clearing the region key’s value.

NOTE(dstanek): I normally don’t like tests that repeat application logic, but in this case we need to. There are too many ways that the tests above can erroneosly pass that we need this sanity check.

test_memoize_decorator_when_invalidating_the_region()[source]
test_multi_methods_when_invalidating_the_region()[source]
test_region_multi_methods_delete()[source]
test_region_singular_methods_delete()[source]
test_singular_methods_when_invalidating_the_region()[source]

keystone.tests.unit.common.test_database_conflicts module

class keystone.tests.unit.common.test_database_conflicts.DuplicateTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.test_v3.RestfulTestCase

test_credential_duplicate_conflict_gives_name()[source]
test_domain_duplicate_conflict_gives_name()[source]
test_federation_protocol_duplicate_conflict_gives_name()[source]
test_federation_protocol_duplicate_conflict_with_id_in_id()[source]
test_federation_protocol_duplicate_conflict_with_id_in_idp_id()[source]
test_group_duplicate_conflict_gives_name()[source]
test_mapping_duplicate_conflict_gives_name()[source]
test_mapping_duplicate_conflict_with_id_in_id()[source]
test_policy_duplicate_conflict_gives_name()[source]
test_project_duplicate_conflict_gives_name()[source]
test_region_duplicate_conflict_gives_name()[source]
test_role_duplicate_conflict_gives_name()[source]
test_sp_duplicate_conflict_gives_name()[source]
test_trust_duplicate_conflict_gives_name()[source]
test_user_duplicate_conflict_gives_name()[source]

keystone.tests.unit.common.test_json_home module

class keystone.tests.unit.common.test_json_home.JsonHomeTest(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

test_build_v3_extension_parameter_relation()[source]
test_build_v3_extension_resource_relation()[source]
test_build_v3_parameter_relation()[source]
test_build_v3_resource_relation()[source]
test_translate_urls()[source]

keystone.tests.unit.common.test_notifications module

exception keystone.tests.unit.common.test_notifications.ArbitraryException[source]

Bases: Exception

class keystone.tests.unit.common.test_notifications.AuditNotificationsTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_resource_created_notification()[source]
test_resource_deleted_notification()[source]
test_resource_disabled_notification()[source]
test_resource_updated_notification()[source]
class keystone.tests.unit.common.test_notifications.BaseNotificationTest(*args, **kwargs)[source]

Bases: keystone.tests.unit.test_v3.RestfulTestCase

setUp()[source]

Setup for v3 Restful Test Cases.

class keystone.tests.unit.common.test_notifications.CADFNotificationsDataTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.test_v3.RestfulTestCase

config_overrides()[source]
test_receive_identityId_from_audit_notification()[source]
class keystone.tests.unit.common.test_notifications.CADFNotificationsForEntities(*args, **kwargs)[source]

Bases: keystone.tests.unit.common.test_notifications.NotificationsForEntities

setUp()[source]

Setup for v3 Restful Test Cases.

test_initiator_data_is_set()[source]
test_initiator_global_request_id()[source]
test_initiator_global_request_id_not_set()[source]
test_initiator_request_id()[source]
class keystone.tests.unit.common.test_notifications.CADFNotificationsForPCIDSSEvents(*args, **kwargs)[source]

Bases: keystone.tests.unit.common.test_notifications.BaseNotificationTest

setUp()[source]

Setup for v3 Restful Test Cases.

test_changing_password_too_early_sends_notification()[source]
test_invalid_password_sends_notification()[source]
test_locked_out_user_sends_notification()[source]
test_password_expired_sends_notification()[source]
test_repeated_password_sends_notification()[source]
class keystone.tests.unit.common.test_notifications.CadfNotificationsWrapperTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.test_v3.RestfulTestCase

ACTION = 'authenticate'
LOCAL_HOST = 'localhost'
ROLE_ASSIGNMENT = 'role_assignment'
setUp()[source]

Setup for v3 Restful Test Cases.

test_add_role_to_user_and_project()[source]
test_group_domain_grant()[source]
test_initiator_always_contains_username()[source]
test_initiator_id_always_matches_user_id()[source]
test_remove_role_from_user_and_project()[source]
test_user_project_grant()[source]
test_v3_authenticate_user_id()[source]
test_v3_authenticate_user_name_and_domain_id()[source]
test_v3_authenticate_user_name_and_domain_name()[source]
test_v3_authenticate_with_invalid_user_id_sends_notification()[source]
test_v3_authenticate_with_invalid_user_name_sends_notification()[source]
class keystone.tests.unit.common.test_notifications.NotificationsForEntities(*args, **kwargs)[source]

Bases: keystone.tests.unit.common.test_notifications.BaseNotificationTest

test_add_user_to_group()[source]
test_config_option_no_events()[source]
test_create_domain()[source]
test_create_endpoint()[source]
test_create_group()[source]
test_create_policy()[source]
test_create_project()[source]
test_create_region()[source]
test_create_role()[source]
test_create_service()[source]
test_create_trust()[source]
test_create_user()[source]
test_delete_domain()[source]
test_delete_endpoint()[source]
test_delete_group()[source]
test_delete_policy()[source]
test_delete_project()[source]
test_delete_region()[source]
test_delete_role()[source]
test_delete_service()[source]
test_delete_trust()[source]
test_delete_user()[source]
test_disable_domain()[source]
test_disable_of_disabled_domain_does_not_notify()[source]
test_disable_of_disabled_project_does_not_notify()[source]
test_disable_project()[source]
test_initiator_global_request_id()[source]
test_initiator_global_request_id_not_set()[source]
test_initiator_request_id()[source]
test_remove_user_from_group()[source]
test_update_domain()[source]
test_update_endpoint()[source]
test_update_group()[source]
test_update_policy()[source]
test_update_project()[source]
test_update_project_does_not_send_disable()[source]
test_update_region()[source]
test_update_role()[source]
test_update_service()[source]
test_update_user()[source]
class keystone.tests.unit.common.test_notifications.NotificationsTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_opt_out_authenticate_event()[source]

Test that authenticate events are successfully opted out.

test_send_audit_notification_with_opt_out()[source]

Test the private method _send_audit_notification with opt-out.

Test that _send_audit_notification does not notify when a valid notification_opt_out configuration is provided.

test_send_notification()[source]

Test _send_notification.

Test the private method _send_notification to ensure event_type, payload, and context are built and passed properly.

test_send_notification_with_opt_out()[source]

Test the private method _send_notification with opt-out.

Test that _send_notification does not notify when a valid notification_opt_out configuration is provided.

class keystone.tests.unit.common.test_notifications.TestCallbackRegistration(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_a_function_callback()[source]
test_a_list_of_callbacks()[source]
test_a_method_callback()[source]
test_an_invalid_callback()[source]
test_an_invalid_event()[source]
verify_log_message(data)[source]

Verify log message.

Tests that use this are a little brittle because adding more logging can break them.

TODO(dstanek): remove the need for this in a future refactoring

class keystone.tests.unit.common.test_notifications.TestEventCallbacks(*args, **kwargs)[source]

Bases: keystone.tests.unit.test_v3.RestfulTestCase

class FakeManager[source]

Bases: object

test_event_registration_for_unknown_resource_type()[source]
test_invalid_event_callbacks()[source]
test_invalid_event_callbacks_event()[source]
test_notification_event_not_valid()[source]
test_notification_method_not_callable()[source]
test_notification_received()[source]
test_provider_event_callback_subscription()[source]
test_provider_event_callbacks_subscription()[source]
test_using_an_unbound_method_as_a_callback_fails()[source]
keystone.tests.unit.common.test_notifications.register_callback(operation, resource_type='e6bb4ea9e4534d0d86d62051b3baed18')[source]

Helper for creating and registering a mock callback.

keystone.tests.unit.common.test_provider_api module

class keystone.tests.unit.common.test_provider_api.TestProviderAPIRegistry(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_deferred_gettr()[source]
test_manager_api_reference()[source]
test_provider_api_mixin()[source]
test_registry_duplicate()[source]
test_registry_lock()[source]

keystone.tests.unit.common.test_rbac_enforcer module

class keystone.tests.unit.common.test_rbac_enforcer.TestRBACEnforcer(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.TestCase

test_enforcer_auto_instantiated()[source]
test_enforcer_shared_state()[source]
class keystone.tests.unit.common.test_rbac_enforcer.TestRBACEnforcerRest(*args, **kwargs)[source]

Bases: keystone.tests.unit.common.test_rbac_enforcer._TestRBACEnforcerBase

test_call_build_enforcement_target()[source]
test_enforce_call_explicit_target_attr()[source]
test_enforce_call_inferred_member_target_data()[source]
test_enforce_call_invalid_action()[source]
test_enforce_call_not_is_authenticated()[source]
test_enforce_call_sets_enforcement_attr()[source]
test_enforce_call_with_filter_values()[source]
test_enforce_call_with_member_target_type_and_member_target()[source]
test_enforce_call_with_pre_instantiated_enforcer()[source]
test_enforce_call_with_subject_token_data()[source]
test_extract_filter_data()[source]
test_extract_member_target_data_bad_input()[source]
test_extract_member_target_data_inferred()[source]
test_extract_member_target_data_supplied_target()[source]
test_extract_policy_check_credentials()[source]
test_extract_subject_token_target_data()[source]
test_is_authenticated_check()[source]
test_policy_enforcer_action_decorator()[source]
test_policy_enforcer_action_invalid_action_decorator()[source]
test_retrive_oslo_req_context()[source]
test_view_args_populated_in_policy_dict()[source]
class keystone.tests.unit.common.test_rbac_enforcer.TestRBACEnforcerRestAdminAuthToken(*args, **kwargs)[source]

Bases: keystone.tests.unit.common.test_rbac_enforcer._TestRBACEnforcerBase

config_overrides()[source]
test_enforce_call_is_admin()[source]
test_enforcer_is_admin_check_with_token()[source]
test_enforcer_is_admin_check_without_token()[source]

keystone.tests.unit.common.test_resource_options_common module

class keystone.tests.unit.common.test_resource_options_common.TestResourceOptionObjects(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

test_duplicate_option_cases()[source]
test_option_init_validation()[source]
test_registry()[source]

keystone.tests.unit.common.test_sql_core module

class keystone.tests.unit.common.test_sql_core.TestModel(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, keystone.common.sql.core.ModelDictMixin

id
text
class keystone.tests.unit.common.test_sql_core.TestModelDictMixin(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

test_creating_a_dict_from_a_model_instance()[source]
test_creating_a_dict_from_a_model_instance_that_has_extra_attrs()[source]
test_creating_a_model_instance_from_a_dict()[source]
test_creating_a_model_instance_from_an_invalid_dict()[source]

keystone.tests.unit.common.test_utils module

class keystone.tests.unit.common.test_utils.FernetUtilsTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_debug_message_logged_when_loading_fernet_token_keys()[source]
test_debug_message_not_logged_when_loading_fernet_credential_key()[source]
class keystone.tests.unit.common.test_utils.ServiceHelperTests(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

test_fail_gracefully()[source]
class keystone.tests.unit.common.test_utils.UtilsTestCase(*args, **kwargs)[source]

Bases: keystone.tests.unit.core.BaseTestCase

OPTIONAL = <object object>
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_auth_str_equal()[source]
test_hash()[source]
test_hash_edge_cases()[source]
test_hash_long_password_strict()[source]
test_hash_long_password_truncation()[source]
test_hash_unicode()[source]
test_hash_user_password_with_empty_password()[source]
test_hash_user_password_with_null_password()[source]
test_hash_user_password_without_password()[source]
test_isotime_returns_microseconds_when_subsecond_is_true()[source]
test_isotime_returns_seconds_when_subsecond_is_false()[source]
test_isotime_rounds_microseconds_of_objects_passed_in()[source]
test_isotime_truncates_microseconds_of_objects_passed_in()[source]
test_resource_64_char_uuid()[source]
test_resource_invalid_id()[source]
test_resource_non_ascii_chars()[source]
test_resource_uuid()[source]
test_that_a_hash_can_not_be_validated_against_a_hash()[source]
test_url_safe_check()[source]
test_url_safe_with_unicode_check()[source]
test_verify_length_and_trunc_password_throws_validation_error()[source]
test_verify_long_password_strict()[source]
test_verify_long_password_strict_raises_exception()[source]
test_verify_normal_password_strict()[source]

Module contents