osc_lib.tests package

Submodules

osc_lib.tests.fakes module

class osc_lib.tests.fakes.FakeApp(_stdout, _log)

Bases: object

class osc_lib.tests.fakes.FakeClientManager

Bases: object

get_configuration()
class osc_lib.tests.fakes.FakeLog

Bases: object

critical(msg)
debug(msg)
error(msg)
info(msg)
warning(msg)
class osc_lib.tests.fakes.FakeOptions(**kwargs)

Bases: object

class osc_lib.tests.fakes.FakeResource(manager=None, info=None, loaded=False, methods=None)

Bases: object

keys()
class osc_lib.tests.fakes.FakeStdout

Bases: object

make_string()
write(text)
osc_lib.tests.fakes.to_unicode_dict(catalog_dict)

Converts dict to unicode dict

osc_lib.tests.test_clientmanager module

class osc_lib.tests.test_clientmanager.Container

Bases: object

attr = <object object>
buggy_attr

Descriptor class for caching created client handles.

class osc_lib.tests.test_clientmanager.TestClientCache(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

test_attribute_error_propagates()
test_singleton()
class osc_lib.tests.test_clientmanager.TestClientManager(*args, **kwargs)

Bases: osc_lib.tests.utils.TestClientManager

test_client_manager_auth_setup_once(*args, **keywargs)
test_client_manager_endpoint_disabled()
test_client_manager_k2k_auth_setup()
test_client_manager_password()
test_client_manager_password_client_cert()
test_client_manager_password_client_key()
test_client_manager_password_verify()
test_client_manager_password_verify_ca()
test_client_manager_password_verify_false()
test_client_manager_password_verify_insecure()
test_client_manager_password_verify_insecure_ca()
test_client_manager_select_auth_plugin_failure()
test_client_manager_select_auth_plugin_password()
test_client_manager_select_auth_plugin_token()

osc_lib.tests.test_logs module

class osc_lib.tests.test_logs.TestContext(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

test_log_level_from_config()
test_log_level_from_options()
test_set_warning_filter(*args, **keywargs)
class osc_lib.tests.test_logs.TestFileFormatter(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

test_config()
test_nothing()
test_options()
class osc_lib.tests.test_logs.TestLogConfigurator(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

setUp()
test_configure(*args, **keywargs)
test_init(*args, **keywargs)
test_init_log_file(*args, **keywargs)
test_init_no_debug(*args, **keywargs)

osc_lib.tests.test_shell module

class osc_lib.tests.test_shell.TestShellArgV(*args, **kwargs)

Bases: osc_lib.tests.utils.TestShell

Test the deferred help flag

setUp()
test_shell_argv()

Test argv decoding

Python 2 does nothing with argv while Python 3 decodes it into Unicode before we ever see it. We manually decode when running under Python 2 so verify that we get the right argv types.

Use the argv supplied by the test runner so we get actual Python runtime behaviour; we only need to check the type of argv[0] which will alwyas be present.

class osc_lib.tests.test_shell.TestShellCli(*args, **kwargs)

Bases: osc_lib.tests.utils.TestShell

Test handling of specific global options

_shell.options is the parsed command line from argparse _shell.client_manager.* are the values actually used

setUp()
test_shell_args_cert_options()

Test client cert options

test_shell_args_cloud_no_vendor(*args, **keywargs)

Test cloud config options without the vendor file

test_shell_args_cloud_public(*args, **keywargs)

Test cloud config options with the vendor file

test_shell_args_no_options()
test_shell_args_precedence(*args, **keywargs)
test_shell_args_tls_options()

Test the TLS verify and CA cert file options

class osc_lib.tests.test_shell.TestShellCliPrecedence(*args, **kwargs)

Bases: osc_lib.tests.utils.TestShell

Test option precedencr order

setUp()
test_shell_args_precedence_1(*args, **keywargs)

Test environment overriding occ

test_shell_args_precedence_2(*args, **keywargs)

Test command line overriding environment and occ

test_shell_args_precedence_3(*args, **keywargs)

Test command line overriding environment and occ

class osc_lib.tests.test_shell.TestShellHelp(*args, **kwargs)

Bases: osc_lib.tests.utils.TestShell

Test the deferred help flag

setUp()
test_help_options(*args, **kwargs)
class osc_lib.tests.test_shell.TestShellOptions(*args, **kwargs)

Bases: osc_lib.tests.utils.TestShell

Test the option handling by argparse and os_client_config

This covers getting the CLI options through the initial processing and validates the arguments to initialize_app() and occ_get_one()

setUp()
test_empty_auth()
test_global_env()
test_global_options()
test_no_options()

osc_lib.tests.test_utils module

class osc_lib.tests.test_utils.FakeOddballResource(manager=None, info=None, loaded=False, methods=None)

Bases: osc_lib.tests.fakes.FakeResource

get() is needed for utils.find_resource()
exception osc_lib.tests.test_utils.NoUniqueMatch

Bases: exceptions.Exception

class osc_lib.tests.test_utils.TestFindResource(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

setUp()
test_find_resource_find()
test_find_resource_find_no_unique()
test_find_resource_find_not_found()
test_find_resource_get_int()
test_find_resource_get_int_string()
test_find_resource_get_name_and_domain()
test_find_resource_get_uuid()
test_find_resource_get_whatever()
test_find_resource_list_forbidden()
test_find_resource_silly_resource()
test_find_resource_silly_resource_no_unique_match()
test_find_resource_silly_resource_not_found()
test_format_dict()
test_format_dict_of_list()
test_format_dict_of_list_with_separator()
test_format_list()
test_format_list_of_dicts()
test_format_list_separator()
class osc_lib.tests.test_utils.TestUtils(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

test_backward_compat_col_lister()
test_backward_compat_col_lister_no_specify_column()
test_backward_compat_col_lister_with_tuple_headers()
test_backward_compat_col_showone()
test_backward_compat_col_showone_no_specify_column()
test_build_kwargs_dict_value_None()
test_build_kwargs_dict_value_empty_str()
test_build_kwargs_dict_value_set()
test_find_min_match_a2()
test_find_min_match_a2_b2()
test_find_min_match_b2()
test_find_min_match_b5()
test_find_min_match_no_flair()
test_find_min_match_no_sort()
test_format_size()
test_get_password_bad_once()
test_get_password_cntrl_d()
test_get_password_good()
test_get_password_no_tty()
test_is_ascii_bytes()
test_is_ascii_string()
test_sort_items_all_with_direction()
test_sort_items_some_with_direction()
test_sort_items_with_empty_key()
test_sort_items_with_invalid_direction()
test_sort_items_with_invalid_key()
test_sort_items_with_multiple_keys()
test_sort_items_with_object()
test_sort_items_with_one_key()
test_wait_for_delete_error(*args, **keywargs)
test_wait_for_delete_error_with_overrides(*args, **keywargs)
test_wait_for_delete_error_with_overrides_exception(*args, **keywargs)
test_wait_for_delete_ok(*args, **keywargs)
test_wait_for_delete_timeout(*args, **keywargs)
test_wait_for_status_error(*args, **keywargs)
test_wait_for_status_error_with_overrides(*args, **keywargs)
test_wait_for_status_ok(*args, **keywargs)
test_wait_for_status_ok_with_overrides(*args, **keywargs)

osc_lib.tests.utils module

class osc_lib.tests.utils.EnvFixture(env=None)

Bases: fixtures.fixture.Fixture

Environment Fixture.

This fixture replaces os.environ with provided env or an empty env.

revert()
exception osc_lib.tests.utils.ParserException

Bases: exceptions.Exception

class osc_lib.tests.utils.TestCase(*args, **kwargs)

Bases: testtools.testcase.TestCase

assertNotCalled(m, msg=None)

Assert a function was not called

setUp()
class osc_lib.tests.utils.TestClientManager(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

ClientManager class test framework

default_password_auth = {'project_name': 'poochie', 'auth_url': 'http://0.0.0.0', 'password': 'scratchy', 'username': 'itchy'}
default_token_auth = {'token': 'foobar', 'auth_url': 'http://0.0.0.0'}
setUp()
stub_auth(json=None, url=None, verb=None, **kwargs)
class osc_lib.tests.utils.TestCommand(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

Test cliff command classes

check_parser(cmd, args, verify_args)
setUp()
class osc_lib.tests.utils.TestShell(*args, **kwargs)

Bases: osc_lib.tests.utils.TestCase

setUp()
shell_class_name = 'osc_lib.shell.OpenStackShell'
osc_lib.tests.utils.fake_execute(shell, cmd)

Pretend to execute shell commands.

osc_lib.tests.utils.make_shell(shell_class=None)

Create a new command shell and mock out some bits.

osc_lib.tests.utils.opt2attr(opt)
osc_lib.tests.utils.opt2env(opt)

Module contents