How to use the awsume.awsumepy.default_plugins.post_add_arguments function in awsume

To help you get started, we’ve selected a few awsume examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_role_arn_explicit(safe_print: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn='arn:aws:iam::123123123123:role/myrole',
        auto_refresh=False,
        version=False,
        unset_variables=False,
        config=None,
        kill=False,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    default_plugins.post_add_arguments(config, arguments, parser)
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_config(safe_print: MagicMock, config_lib: MagicMock, stdout: MagicMock, stderr: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn=False,
        auto_refresh=False,
        version=False,
        unset_variables=False,
        config=['clear', 'role-duration'],
        kill=False,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    with pytest.raises(SystemExit):
        default_plugins.post_add_arguments(config, arguments, parser)
    config_lib.update_config.assert_called_with(arguments.config)
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_set_target_profile_name_role_arn(safe_print: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn='arn:aws:iam::123123123123:role/myrole',
        auto_refresh=False,
        version=False,
        unset_variables=False,
        config=None,
        kill=False,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    default_plugins.post_add_arguments(config, arguments, parser)
    assert arguments.target_profile_name == 'arn:aws:iam::123123123123:role/myrole'
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_set_target_profile_name(safe_print: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn=None,
        auto_refresh=False,
        version=False,
        unset_variables=False,
        config=None,
        kill=False,
        profile_name='profile',
    )
    parser = argparse.ArgumentParser()
    default_plugins.post_add_arguments(config, arguments, parser)
    assert arguments.target_profile_name == 'profile'
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_kill(safe_print: MagicMock, kill: MagicMock, stdout: MagicMock, stderr: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn=False,
        auto_refresh=False,
        version=False,
        unset_variables=False,
        config=None,
        kill=True,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    with pytest.raises(SystemExit):
        default_plugins.post_add_arguments(config, arguments, parser)
    kill.assert_called_with(arguments)
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_role_arn_short_bad_number_parts(safe_print: MagicMock, stdout: MagicMock, stderr: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn='notanid:myrole:other',
        auto_refresh=False,
        version=False,
        unset_variables=False,
        config=None,
        kill=False,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    with pytest.raises(SystemExit):
        default_plugins.post_add_arguments(config, arguments, parser)
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_role_arn_no_auto_refresh(safe_print: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn=True,
        auto_refresh=True,
        version=False,
        unset_variables=False,
        config=False,
        kill=False,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    with pytest.raises(SystemExit):
        default_plugins.post_add_arguments(config, arguments, parser)
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_version(safe_print: MagicMock, stdout: MagicMock, stderr: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn=False,
        auto_refresh=False,
        version=True,
        unset_variables=False,
        config=False,
        kill=False,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    with pytest.raises(SystemExit):
        default_plugins.post_add_arguments(config, arguments, parser)
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_unset_variables(safe_print: MagicMock, stdout: MagicMock, stderr: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn=False,
        auto_refresh=False,
        version=False,
        unset_variables=True,
        config=False,
        kill=False,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    with pytest.raises(SystemExit):
        default_plugins.post_add_arguments(config, arguments, parser)
github trek10inc / awsume / test / unit / awsume / awsumepy / test_default_plugins.py View on Github external
def test_post_add_arguments_role_arn_short_bad_id(safe_print: MagicMock, stdout: MagicMock, stderr: MagicMock):
    config = {}
    arguments = argparse.Namespace(
        role_arn='notanid:myrole',
        auto_refresh=False,
        version=False,
        unset_variables=False,
        config=None,
        kill=False,
        profile_name=None,
    )
    parser = argparse.ArgumentParser()
    with pytest.raises(SystemExit):
        default_plugins.post_add_arguments(config, arguments, parser)