Skip to content

Commit

Permalink
eek out some test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
djcrabhat committed May 7, 2017
1 parent 7e8f30f commit 5b02087
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/aws_lambda/test_bless_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ class Context(object):
"kmsauth_token": "validkmsauthtoken"
}

VALID_TEST_KMSAUTH_REQUEST_DIFFERENT_REMOTE_USER = {
"remote_usernames": "ubuntu",
INVALID_TEST_KMSAUTH_REQUEST_DIFFERENT_REMOTE_USER = {
"remote_usernames": "root",
"public_key_to_sign": EXAMPLE_RSA_PUBLIC_KEY,
"command": "ssh user@server",
"bastion_ips": "127.0.0.1",
Expand All @@ -132,7 +132,6 @@ class Context(object):
"kmsauth_token": "validkmsauthtoken"
}


os.environ['AWS_REGION'] = 'us-west-2'


Expand Down Expand Up @@ -306,6 +305,7 @@ def test_invalid_request_with_multiple_principals():
'bless-test.cfg'))
assert output['errorType'] == 'InputValidationError'


def test_invalid_request_with_mismatched_bastion_and_remote():
output = lambda_handler(INVALID_TEST_KMSAUTH_REQUEST_USERNAME_DOESNT_MATCH_REMOTE, context=Context,
ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
Expand All @@ -314,8 +314,9 @@ def test_invalid_request_with_mismatched_bastion_and_remote():
'bless-test-kmsauth.cfg'))
assert output['errorType'] == 'KMSAuthValidationError'

def test_valid_request_with_allowed_remote():
output = lambda_handler(VALID_TEST_KMSAUTH_REQUEST_DIFFERENT_REMOTE_USER, context=Context,

def test_invalid_request_with_unallowed_remote():
output = lambda_handler(INVALID_TEST_KMSAUTH_REQUEST_DIFFERENT_REMOTE_USER, context=Context,
ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
entropy_check=False,
config_file=os.path.join(os.path.dirname(__file__),
Expand Down

0 comments on commit 5b02087

Please sign in to comment.