oslo_policy.tests.base.
FakeCheck
(result=None)¶Bases: oslo_policy._checks.BaseCheck
oslo_policy.tests.base.
PolicyBaseTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
create_config_file
(filename, contents)¶Create a configuration file under the config dir.
Also creates any intermediate paths needed so the file can be in a subdirectory.
get_config_file_fullname
(filename)¶setUp
()¶Hook method for setting up the test fixture before exercising it.
oslo_policy.tests.test_checks.
AndCheckTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_add_check
()¶test_call_all_false
()¶test_call_first_true
()¶test_call_second_true
()¶test_init
()¶test_rule_does_not_take_current_rule
()¶test_rule_takes_current_rule
()¶test_str
()¶oslo_policy.tests.test_checks.
CheckForTest
(kind, match)¶Bases: oslo_policy._checks.Check
oslo_policy.tests.test_checks.
CheckRegisterTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_register_check
(**keywargs)¶test_register_check_decorator
(**keywargs)¶oslo_policy.tests.test_checks.
CheckTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_init
()¶test_str
()¶oslo_policy.tests.test_checks.
FalseCheckTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_call
()¶test_str
()¶oslo_policy.tests.test_checks.
GenericCheckTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_accept
()¶test_constant_literal_accept
()¶test_constant_literal_mismatch
()¶test_constant_string_accept
()¶test_constant_string_mismatch
()¶test_cred_mismatch
()¶test_deep_credentials_dictionary_lookup
()¶test_entry_not_in_list_rejected
()¶test_generic_missing_role_does_not_matches
()¶test_generic_role_check_matches
()¶test_missing_credentials_dictionary_lookup
()¶test_multiple_entries_one_matches
()¶test_multiple_entry_in_list_accepted
()¶test_multiple_entry_in_nested_list_accepted
()¶test_multiple_nested_lists_accepted
()¶test_no_cred
()¶test_no_key_match_in_target
()¶test_single_entry_in_list_accepted
()¶oslo_policy.tests.test_checks.
NotCheckTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_call_false
()¶test_call_true
()¶test_init
()¶test_rule_does_not_take_current_rule
()¶test_rule_takes_current_rule
()¶test_str
()¶oslo_policy.tests.test_checks.
OrCheckTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_add_check
()¶test_call_all_false
()¶test_call_first_true
()¶test_call_second_true
()¶test_init
()¶test_pop_check
()¶test_rule_does_not_take_current_rule
()¶test_rule_takes_current_rule
()¶test_str
()¶oslo_policy.tests.test_checks.
RoleCheckTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_accept
()¶test_format_value
()¶test_no_roles_case
()¶test_reject
()¶oslo_policy.tests.test_checks.
RuleCheckTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_rule_false
()¶test_rule_missing
()¶test_rule_true
()¶oslo_policy.tests.test_external.
HttpCheckTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
decode_post_data
(post_data)¶setUp
()¶Hook method for setting up the test fixture before exercising it.
test_accept
()¶test_accept_json
()¶test_accept_with_rule_in_argument
()¶test_http_with_objects_in_target
()¶test_http_with_strings_in_target
()¶test_reject
()¶test_reject_with_rule_in_argument
()¶oslo_policy.tests.test_external.
HttpsCheckTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
decode_post_data
(post_data)¶setUp
()¶Hook method for setting up the test fixture before exercising it.
test_https_accept
()¶test_https_accept_json
()¶test_https_accept_with_verify
()¶test_https_accept_with_verify_and_client_certs
()¶test_https_accept_with_verify_cert
()¶test_https_reject
()¶test_https_with_objects_in_target
()¶test_https_with_strings_in_target
()¶oslo_policy.tests.test_generator.
GeneratePolicyTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
setUp
()¶Hook method for setting up the test fixture before exercising it.
test_merged_rules
()¶oslo_policy.tests.test_generator.
GenerateSampleJSONTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
setUp
()¶Hook method for setting up the test fixture before exercising it.
test_expected_content
()¶test_expected_content_stdout
()¶test_generate_loadable_json
()¶oslo_policy.tests.test_generator.
GenerateSampleYAMLTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
setUp
()¶Hook method for setting up the test fixture before exercising it.
test_deprecated_policies_are_aliased_to_new_names
()¶test_deprecated_policies_with_same_name
()¶test_empty_line_formatting
()¶test_expected_content
()¶test_expected_content_stdout
()¶test_generate_loadable_yaml
()¶test_invalid_formatting
()¶test_literal_block_formatting
()¶test_paragraph_formatting
()¶test_policies_deprecated_for_removal
()¶oslo_policy.tests.test_generator.
GeneratorRaiseErrorTestCase
(*args, **kwargs)¶Bases: testtools.testcase.TestCase
test_generator_call_with_no_arguments_raises_error
()¶test_generator_raises_error
()¶Verifies that errors from extension manager are not suppressed.
oslo_policy.tests.test_generator.
GetEnforcerTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_get_enforcer
(**keywargs)¶test_get_enforcer_missing
(**keywargs)¶oslo_policy.tests.test_generator.
ListRedundantTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
setUp
()¶Hook method for setting up the test fixture before exercising it.
test_matched_rules
()¶oslo_policy.tests.test_generator.
UpgradePolicyTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
setUp
()¶Hook method for setting up the test fixture before exercising it.
test_upgrade_policy_json_file
()¶test_upgrade_policy_json_stdout
()¶test_upgrade_policy_yaml_file
()¶test_upgrade_policy_yaml_stdout
()¶oslo_policy.tests.test_parser.
ParseCheckTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_bad_rule
()¶test_check
(**keywargs)¶test_check_default
(**keywargs)¶test_false
()¶test_no_handler
(**keywargs)¶test_true
()¶oslo_policy.tests.test_parser.
ParseListRuleTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_empty
()¶test_multi_multi
(**keywargs)¶test_multi_oneele
(**keywargs)¶test_oneele_bare
(**keywargs)¶test_oneele_multi
(**keywargs)¶test_oneele_oneele
(**keywargs)¶test_oneele_zeroele
(**keywargs)¶oslo_policy.tests.test_parser.
ParseRuleTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_parse_rule_list
(**keywargs)¶test_parse_rule_string
(**keywargs)¶oslo_policy.tests.test_parser.
ParseStateMetaTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_parse_state_meta
()¶test_reducer
()¶oslo_policy.tests.test_parser.
ParseStateTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_extend_and_expr
()¶test_extend_or_expr
()¶test_init
()¶test_make_and_expr
(**keywargs)¶test_make_not_expr
(**keywargs)¶test_make_or_expr
(**keywargs)¶test_reduce_multi
(**keywargs)¶test_reduce_none
(**keywargs)¶test_reduce_one
(**keywargs)¶test_reduce_short
(**keywargs)¶test_reduce_two
(**keywargs)¶test_result
()¶test_result_empty
()¶test_result_unreduced
()¶test_shift
()¶test_wrap_check
()¶oslo_policy.tests.test_parser.
ParseTextRuleTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_A_and_B_and_C
()¶test_A_and_B_and_C_and_D
()¶test_A_and_B_and_C_or_D
()¶test_A_and_B_or_C
()¶test_A_and_B_or_C_and_D
()¶test_A_and_B_or_C_or_D
()¶test_A_and_B_or_C_with_group_1
()¶test_A_and_B_or_C_with_group_2
()¶test_A_and_B_or_C_with_group_and_not_1
()¶test_A_and_B_or_C_with_group_and_not_2
()¶test_A_and_B_or_C_with_group_and_not_3
()¶test_A_and_B_or_C_with_group_and_not_4
()¶test_A_and_B_or_C_with_group_and_not_5
()¶test_A_and_B_or_C_with_group_and_not_6
()¶test_A_and_B_or_C_with_group_and_not_7
()¶test_A_and_B_or_C_with_group_and_not_8
()¶test_A_and_B_or_C_with_not_1
()¶test_A_and_B_or_C_with_not_2
()¶test_A_and_B_or_C_with_not_3
()¶test_A_or_B_and_C
()¶test_A_or_B_and_C_and_D
()¶test_A_or_B_and_C_or_D
()¶test_A_or_B_or_C
()¶test_A_or_B_or_C_and_D
()¶test_A_or_B_or_C_or_D
()¶test_empty
()¶test_fail
(**keywargs)¶test_shifts
(**keywargs)¶Test of Policy Engine
oslo_policy.tests.test_policy.
BaseCheckTypesTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_base_check_types_are_public
(**keywargs)¶Check that those check types are part of public API.
They are blessed to be used by library consumers.
oslo_policy.tests.test_policy.
CheckFunctionTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
setUp
()¶Hook method for setting up the test fixture before exercising it.
test_check_explicit
()¶test_check_no_rules
()¶test_check_raise_custom_exception
()¶test_check_raise_default
()¶test_check_rule_not_exist_not_empty_policy_file
()¶test_check_with_rule
()¶oslo_policy.tests.test_policy.
DocumentedRuleDefaultDeprecationTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_deprecate_a_policy_check_string
()¶test_deprecate_a_policy_for_removal_does_not_log_warning
()¶test_deprecate_a_policy_for_removal_logs_warning_when_overridden
()¶test_deprecate_a_policy_name
()¶test_deprecate_check_str_suppress_does_not_log_warning
()¶test_deprecate_for_removal_suppress_does_not_log_warning
()¶test_deprecate_name_suppress_does_not_log_warning
()¶test_deprecated_policy_for_removal_must_include_deprecated_since
()¶test_deprecated_policy_must_include_deprecated_reason
()¶test_deprecated_policy_must_include_deprecated_since
()¶test_deprecated_rule_requires_deprecated_rule_object
()¶test_override_both_new_and_old_policy
()¶test_override_deprecated_policy_with_new_name
()¶test_override_deprecated_policy_with_old_name
()¶oslo_policy.tests.test_policy.
DocumentedRuleDefaultTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_contain_operations
()¶test_description_not_empty
()¶test_multiple_operations
()¶test_operation_must_be_list
()¶test_operation_must_be_list_of_dicts
()¶test_operation_must_contain_method_and_path_only
()¶test_operation_must_have_method
()¶test_operation_must_have_path
()¶test_operation_not_empty_list
()¶oslo_policy.tests.test_policy.
EnforcerCheckRulesTest
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
setUp
()¶Hook method for setting up the test fixture before exercising it.
test_complex_cyclical_rules_false
()¶test_complex_cyclical_rules_true
()¶test_cyclical_rules
()¶test_cyclical_rules_raises
()¶test_no_violations
()¶test_undefined_rule
()¶test_undefined_rule_raises
()¶oslo_policy.tests.test_policy.
EnforcerNoPolicyFileTest
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
check_loaded_files
(filenames)¶setUp
()¶Hook method for setting up the test fixture before exercising it.
test_load_directory
()¶test_load_rules
()¶test_opts_registered
()¶oslo_policy.tests.test_policy.
EnforcerTest
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
check_loaded_files
(filenames)¶setUp
()¶Hook method for setting up the test fixture before exercising it.
test_clear
(**keywargs)¶test_clear_opts_registered
()¶test_enforcer_accepts_context_objects
()¶test_enforcer_accepts_policy_values_from_context
()¶test_enforcer_accepts_subclassed_context_objects
()¶test_enforcer_call_map_context_attributes
(**keywargs)¶test_enforcer_consolidates_context_attributes_with_creds
()¶test_enforcer_default_rule_name
()¶test_enforcer_force_reload_false
()¶test_enforcer_force_reload_with_overwrite
(opts_registered=0)¶test_enforcer_force_reload_with_overwrite_opts_registered
()¶test_enforcer_force_reload_without_overwrite
(opts_registered=0)¶test_enforcer_force_reload_without_overwrite_opts_registered
()¶test_enforcer_keep_use_conf_flag_after_reload
()¶test_enforcer_keep_use_conf_flag_after_reload_opts_registered
()¶test_enforcer_overwrite_rules
()¶test_enforcer_raises_invalid_scope_with_domain_scope_type
()¶test_enforcer_raises_invalid_scope_with_project_scope_type
()¶test_enforcer_raises_invalid_scope_with_system_scope_type
()¶test_enforcer_register_twice_raises
()¶test_enforcer_rejects_non_context_objects
()¶test_enforcer_set_rules
()¶test_enforcer_understands_domain_scope
()¶test_enforcer_understands_project_scope
()¶test_enforcer_understands_system_scope
()¶test_enforcer_update_rules
()¶test_enforcer_with_default_policy_file
()¶test_enforcer_with_default_rule
()¶test_enforcer_with_policy_file
()¶test_get_policy_path_raises_exc
()¶test_load_dir_caching_with_files_same_overwrite_false_opts_reg
()¶test_load_directory
()¶test_load_directory_caching_with_files_same
(overwrite=True)¶test_load_directory_caching_with_files_same_but_overwrite_false
()¶test_load_directory_caching_with_files_same_opts_registered
()¶test_load_directory_caching_with_files_updated
()¶test_load_directory_caching_with_files_updated_opts_registered
()¶test_load_directory_opts_registered
()¶test_load_directory_twice
(**keywargs)¶test_load_directory_twice_changed
(**keywargs)¶test_load_directory_twice_force
(**keywargs)¶test_load_file
()¶test_load_file_opts_registered
()¶test_load_multiple_directories
()¶test_load_multiple_directories_opts_registered
()¶test_load_non_existed_directory
()¶test_load_non_existed_directory_opts_registered
()¶test_load_policy_dirs_with_non_directory
()¶test_load_rules_twice
(**keywargs)¶test_load_rules_twice_clear
(**keywargs)¶test_load_rules_twice_force
(**keywargs)¶test_map_context_attributes_populated_system
()¶test_non_reversible_check
()¶test_rule_with_check
()¶test_set_rules_type
()¶oslo_policy.tests.test_policy.
FieldCheck
(kind, match)¶Bases: oslo_policy._checks.Check
A non reversible check.
All oslo.policy defined checks have a __str__ method with the property that rule == str(_parser.parse_rule(rule)). Consumers of oslo.policy may have defined checks for which that does not hold true. This FieldCheck is not reversible so we can use it for testing to ensure that this type of check does not break anything.
oslo_policy.tests.test_policy.
MyException
(*args, **kwargs)¶Bases: exceptions.Exception
oslo_policy.tests.test_policy.
RegisterCheckTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_register_check
(**keywargs)¶oslo_policy.tests.test_policy.
RuleDefaultTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
test_create_opt_with_multiple_scope_types
()¶test_create_opt_with_scope_type_strings_fails
()¶test_create_opt_with_scope_types
()¶test_ensure_scope_types_are_unique
()¶test_equal_subclass
()¶test_equality_less_obvious
()¶test_equality_obvious
()¶test_not_equal_check
()¶test_not_equal_class
()¶test_not_equal_name
()¶test_not_equal_subclass
()¶test_rule_is_parsed
()¶test_str
()¶oslo_policy.tests.test_policy.
RulesTestCase
(*args, **kwds)¶Bases: oslotest.base.BaseTestCase
test_from_dict
(**keywargs)¶test_init
()¶test_init_basic
()¶test_load_empty_data
(**keywargs)¶test_load_json
(**keywargs)¶test_load_json_deprecated
()¶test_load_json_invalid_exc
(**keywargs)¶test_load_yaml
(**keywargs)¶test_load_yaml_invalid_exc
(**keywargs)¶test_missing_default
()¶test_no_default
()¶test_retrieval
()¶test_str
()¶test_str_true
()¶test_with_default
()¶oslo_policy.tests.test_shell.
CheckerTestCase
(*args, **kwds)¶Bases: oslo_policy.tests.base.PolicyBaseTestCase
SAMPLE_POLICY
= '---\n"sample_rule": "role:service"\n"sampleservice:sample_rule": ""\n'¶SAMPLE_POLICY_UNSORTED
= '---\n"sample_rule": "role:service"\n"sampleservice:sample_rule2": ""\n"sampleservice:sample_rule0": ""\n"sampleservice:sample_rule1": ""\n'¶setUp
()¶Hook method for setting up the test fixture before exercising it.
test_all_nonadmin
()¶test_flatten_from_dict
()¶test_flatten_from_file
()¶test_pass_rule_parameters
(**keywargs)¶test_pass_rule_parameters_sorted
()¶test_pass_rule_parameters_with_custom_target
(**keywargs)¶Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.