Merge pull request #2776 from bblommers/python-2-readyness
Python 2 dependencies + Test fix
This commit is contained in:
commit
9024031ca2
3 changed files with 14 additions and 11 deletions
|
|
@ -274,9 +274,7 @@ def test_access_denied_with_not_allowing_policy():
|
|||
user_name = "test-user"
|
||||
inline_policy_document = {
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{"Effect": "Allow", "Action": ["ec2:Describe*"], "Resource": "*"}
|
||||
],
|
||||
"Statement": [{"Effect": "Allow", "Action": ["ec2:Run*"], "Resource": "*"}],
|
||||
}
|
||||
access_key = create_user_with_access_key_and_inline_policy(
|
||||
user_name, inline_policy_document
|
||||
|
|
@ -288,12 +286,14 @@ def test_access_denied_with_not_allowing_policy():
|
|||
aws_secret_access_key=access_key["SecretAccessKey"],
|
||||
)
|
||||
with assert_raises(ClientError) as ex:
|
||||
client.run_instances(MaxCount=1, MinCount=1)
|
||||
client.describe_instances()
|
||||
ex.exception.response["Error"]["Code"].should.equal("AccessDenied")
|
||||
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(403)
|
||||
ex.exception.response["Error"]["Message"].should.equal(
|
||||
"User: arn:aws:iam::{account_id}:user/{user_name} is not authorized to perform: {operation}".format(
|
||||
account_id=ACCOUNT_ID, user_name=user_name, operation="ec2:RunInstances"
|
||||
account_id=ACCOUNT_ID,
|
||||
user_name=user_name,
|
||||
operation="ec2:DescribeInstances",
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue