AWSLambda - refactor exception handling
This commit is contained in:
parent
ad23b65784
commit
c6dd3c96ea
4 changed files with 56 additions and 42 deletions
|
|
@ -4,6 +4,7 @@ import os
|
|||
import json
|
||||
|
||||
import boto
|
||||
import boto3
|
||||
import boto.iam
|
||||
import boto.s3
|
||||
import boto.s3.key
|
||||
|
|
@ -19,9 +20,9 @@ from moto import (
|
|||
mock_cloudformation_deprecated,
|
||||
mock_s3_deprecated,
|
||||
mock_route53_deprecated,
|
||||
mock_iam,
|
||||
)
|
||||
from moto.cloudformation import cloudformation_backends
|
||||
from moto.iam import mock_iam_deprecated
|
||||
|
||||
dummy_template = {
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
|
|
@ -596,9 +597,8 @@ def test_create_stack_kinesis():
|
|||
|
||||
|
||||
def get_role_name():
|
||||
with mock_iam_deprecated():
|
||||
iam = boto.connect_iam()
|
||||
role = iam.create_role("my-role")["create_role_response"]["create_role_result"][
|
||||
"role"
|
||||
]["arn"]
|
||||
return role
|
||||
with mock_iam():
|
||||
iam = boto3.client("iam")
|
||||
return iam.create_role(
|
||||
RoleName="TestRole", AssumeRolePolicyDocument="some_policy"
|
||||
)["Role"]["Arn"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue