tests.unit.core package

Submodules

tests.unit.core.test_blacklisting module

class tests.unit.core.test_blacklisting.BlacklistingTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

test_report_issue()
test_report_issue_defaults()

tests.unit.core.test_config module

class tests.unit.core.test_config.TempFile(contents=None)

Bases: fixtures.fixture.Fixture

setUp()
class tests.unit.core.test_config.TestConfigCompat(*args, **kwargs)

Bases: testtools.testcase.TestCase

sample_yaml = '\nprofiles:\n test_1:\n include:\n - any_other_function_with_shell_equals_true\n - assert_used\n exclude:\n\n test_2:\n include:\n - blacklist_calls\n\n test_3:\n include:\n - blacklist_imports\n\n test_4:\n exclude:\n - assert_used\n\n test_5:\n exclude:\n - blacklist_calls\n - blacklist_imports\n\n test_6:\n include:\n - blacklist_calls\n\n exclude:\n - blacklist_imports\n\nblacklist_calls:\n bad_name_sets:\n - pickle:\n qualnames: [pickle.loads]\n message: "{func} library appears to be in use."\n\nblacklist_imports:\n bad_import_sets:\n - telnet:\n imports: [telnetlib]\n level: HIGH\n message: "{module} is considered insecure."\n'
setUp()
test_bad_yaml()
test_blacklist_error()
test_converted_blacklist_call_data()
test_converted_blacklist_call_test()
test_converted_blacklist_import_data()
test_converted_blacklist_import_test()
test_converted_exclude()
test_converted_exclude_blacklist()
test_converted_include()
test_deprecation_message()
class tests.unit.core.test_config.TestGetOption(*args, **kwargs)

Bases: testtools.testcase.TestCase

setUp()
test_levels()
test_levels_not_exist()
class tests.unit.core.test_config.TestGetSetting(*args, **kwargs)

Bases: testtools.testcase.TestCase

setUp()
test_not_exist()
class tests.unit.core.test_config.TestInit(*args, **kwargs)

Bases: testtools.testcase.TestCase

test_file_does_not_exist()
test_settings()
test_yaml_invalid()

tests.unit.core.test_context module

class tests.unit.core.test_context.ContextTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

test__get_literal_value()
test_call_args(*args, **keywargs)
test_call_args_count()
test_call_function_name()
test_call_function_name_qual()
test_call_keywords(*args, **keywargs)
test_check_call_arg_value(*args, **keywargs)
test_context_create()
test_function_def_defaults_qual(*args, **keywargs)
test_get_call_arg_at_position()
test_get_lineno_for_call_arg(*args, **keywargs)
test_is_module_being_imported()
test_is_module_imported_exact()
test_is_module_imported_like()
test_node()
test_repr()
test_statement()
test_string_val()

tests.unit.core.test_issue module

class tests.unit.core.test_issue.IssueTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

test_get_code(*args, **keywargs)
test_issue_as_dict()
test_issue_create()
test_issue_filter_confidence()
test_issue_filter_severity()
test_issue_str()
test_matches_issue()

tests.unit.core.test_manager module

class tests.unit.core.test_manager.ManagerTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

setUp()
test_compare_baseline()
test_create_manager()
test_create_manager_with_profile()
test_discover_files_exclude(*args, **keywargs)
test_discover_files_exclude_cmdline(*args, **keywargs)
test_discover_files_include(*args, **keywargs)
test_discover_files_recurse_files(*args, **keywargs)
test_discover_files_recurse_skip(*args, **keywargs)
test_find_candidate_matches()
test_get_files_from_dir(*args, **keywargs)
test_is_file_included()
test_matches_globlist()
test_output_results_invalid_format()
test_output_results_valid_format()
test_populate_baseline_invalid_json(*args, **keywargs)
test_populate_baseline_success()
test_results_count()
test_run_tests_ioerror()
test_run_tests_keyboardinterrupt()

tests.unit.core.test_meta_ast module

class tests.unit.core.test_meta_ast.BanditMetaAstTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

setUp()
test_add_node()
test_str()

tests.unit.core.test_test_set module

class tests.unit.core.test_test_set.BanditTestSetTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

setUp()
tearDown()
test_has_defaults()
test_profile_blacklist_compat()
test_profile_exclude_builtin_blacklist()
test_profile_exclude_builtin_blacklist_specific()
test_profile_exclude_id()
test_profile_exclude_none()
test_profile_filter_blacklist_all()
test_profile_filter_blacklist_include()
test_profile_filter_blacklist_none()
test_profile_filter_blacklist_one()
test_profile_has_builtin_blacklist()
test_profile_include_id()
test_profile_include_none()
tests.unit.core.test_test_set.test_plugin()

tests.unit.core.test_util module

class tests.unit.core.test_util.UtilTests(*args, **kwargs)

Bases: testtools.testcase.TestCase

This set of tests exercises bandit.core.util functions.

setUp()
test_check_ast_node_bad_node()
test_check_ast_node_bad_type()
test_check_ast_node_good()
test_deepgetattr()
test_escaped_representation_invalid()
test_escaped_representation_mixed()
test_escaped_representation_simple()
test_escaped_representation_valid_not_printable()
test_get_call_name1()

Gets a qualified call name.

test_get_call_name2()

Gets qualified call name and resolves aliases.

test_get_call_name3()

Getting name for a complex call.

test_get_module_qualname_from_path_abs_missingend()
test_get_module_qualname_from_path_abs_missingmid()
test_get_module_qualname_from_path_abs_syms()

Test get_module_qualname_from_path with symlink in path.

test_get_module_qualname_from_path_abs_typical()

Test get_module_qualname_from_path with typical absolute paths.

test_get_module_qualname_from_path_dir()

Test get_module_qualname_from_path with dir path.

test_get_module_qualname_from_path_invalid_path()

Test get_module_qualname_from_path with invalid path.

test_get_module_qualname_from_path_rel_missingend()
test_get_module_qualname_from_path_rel_missingmid()
test_get_module_qualname_from_path_rel_syms()

Test get_module_qualname_from_path with symbolic relative paths.

test_get_module_qualname_from_path_rel_typical()

Test get_module_qualname_from_path with typical relative paths.

test_get_module_qualname_from_path_sys()

Test get_module_qualname_from_path with system module paths.

test_get_module_qualname_from_path_with_dot()

Test get_module_qualname_from_path with a ”.” .

test_linerange()
test_namespace_path_join()
test_namespace_path_split()
test_parse_ini_file()
test_path_for_function()
test_path_for_function_no_file()
test_path_for_function_no_module()

Module contents