Esempio n. 1
0
def test_validate_profile_no_source_profile_default():
    profiles = {
        'myuser': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
        },
        'myrole': {
            'role_arn': 'arn:aws:iam:XXX:role/role_name',
        },
    }
    with pytest.raises(ProfileNotFoundError):
        profile.validate_profile(profiles, 'myrole')
Esempio n. 2
0
def test_validate_profile():
    profiles = {
        'myuser': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
        },
        'myrole': {
            'role_arn': 'arn:aws:iam:XXX:role/role_name',
            'source_profile': 'myuser',
        },
    }
    profile.validate_profile(profiles, 'myrole')
Esempio n. 3
0
def test_validate_profile_user_missing_secret_access_key():
    profiles = {
        'myuser': {
            'aws_access_key_id': 'AKIA...',
        },
        'myrole': {
            'role_arn': 'arn:aws:iam:XXX:role/role_name',
            'source_profile': 'admin',
        },
    }
    with pytest.raises(InvalidProfileError):
        profile.validate_profile(profiles, 'myuser')
Esempio n. 4
0
def test_validate_profile():
    config = {}
    arguments = argparse.Namespace(output_profile=None, auto_refresh=False)
    profiles = {
        'myuser': {
            'aws_access_key_id': 'AKIA...',
            'aws_secret_access_key': 'SECRET',
        },
        'myrole': {
            'role_arn': 'arn:aws:iam:XXX:role/role_name',
            'source_profile': 'myuser',
        },
    }
    profile.validate_profile(config, arguments, profiles, 'myrole')
Esempio n. 5
0
def test_validate_profile_user_missing_secret_access_key():
    config = {}
    arguments = argparse.Namespace(output_profile=None, auto_refresh=False)
    profiles = {
        'myuser': {
            'aws_access_key_id': 'AKIA...',
        },
        'myrole': {
            'role_arn': 'arn:aws:iam:XXX:role/role_name',
            'source_profile': 'admin',
        },
    }
    with pytest.raises(InvalidProfileError):
        profile.validate_profile(config, arguments, profiles, 'myuser')