Beispiel #1
0
def test_get_config_argument(monkeypatch, tmp_path):
    '''
    Test loading a config param from config profile
    '''
    monkeypatch.setenv('HOME', str(tmp_path))
    init_tmpdir(tmp_path, 'expired')
    from awsmfav2.cli import CLI
    cli = CLI()
    oath_credential = cli._get_argument('yk_oath_credential')
    assert (oath_credential == 'test_oath_cred')
Beispiel #2
0
def test_get_cli_argument(monkeypatch, tmp_path):
    '''
    Test loading a config param from CLI
    '''
    monkeypatch.setenv('HOME', str(tmp_path))
    init_tmpdir(tmp_path, 'expired')
    from awsmfav2.cli import CLI
    cli = CLI()
    duration = cli._get_argument('duration')
    assert (duration == 666)
Beispiel #3
0
def test_get_config_argument(monkeypatch, tmp_path):
    """
    Test loading a config param from config profile
    """
    monkeypatch.setenv("HOME", str(tmp_path))
    init_tmpdir(tmp_path, "expired")
    from awsmfav2.cli import CLI

    cli = CLI()
    oath_credential = cli._get_argument("yk_oath_credential")
    assert oath_credential == "test_oath_cred"
Beispiel #4
0
def test_get_cli_argument(monkeypatch, tmp_path):
    """
    Test loading a config param from CLI
    """
    monkeypatch.setenv("HOME", str(tmp_path))
    init_tmpdir(tmp_path, "expired")
    from awsmfav2.cli import CLI

    cli = CLI()
    duration = cli._get_argument("duration")
    assert duration == 666
Beispiel #5
0
def test_main_unexpired_creds(monkeypatch, tmp_path):
    '''
    Test that we can actually call mock STS and get back creds
    '''
    monkeypatch.setenv('HOME', str(tmp_path))
    monkeypatch.setenv('AWS_MFA_DURATION', '900')
    init_tmpdir(tmp_path, 'unexpired')
    from awsmfav2.cli import CLI
    cli = CLI()
    cli.main()
    assert (cli._get_argument('duration') == '900')
Beispiel #6
0
def test_main_unexpired_creds(monkeypatch, tmp_path):
    """
    Test that we can actually call mock STS and get back creds
    """
    monkeypatch.setenv("HOME", str(tmp_path))
    monkeypatch.setenv("AWS_MFA_DURATION", "900")
    init_tmpdir(tmp_path, "unexpired")
    from awsmfav2.cli import CLI

    cli = CLI()
    cli.main()
    assert cli._get_argument("duration") == "900"