Fix for moto not unmocking.
- Fixes #2575 - Also upgraded Travis CI to make use of Bionic instead of Xenial - This may also address concerns raised in #1793
This commit is contained in:
parent
6922606398
commit
bd777cad44
5 changed files with 31 additions and 28 deletions
|
|
@ -1001,10 +1001,10 @@ def test_list_versions_by_function_for_nonexistent_function():
|
|||
@mock_lambda
|
||||
@mock_sqs
|
||||
def test_create_event_source_mapping():
|
||||
sqs = boto3.resource("sqs")
|
||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||
queue = sqs.create_queue(QueueName="test-sqs-queue1")
|
||||
|
||||
conn = boto3.client("lambda")
|
||||
conn = boto3.client("lambda", region_name="us-east-1")
|
||||
func = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
|
|
@ -1030,11 +1030,11 @@ def test_create_event_source_mapping():
|
|||
@mock_lambda
|
||||
@mock_sqs
|
||||
def test_invoke_function_from_sqs():
|
||||
logs_conn = boto3.client("logs")
|
||||
sqs = boto3.resource("sqs")
|
||||
logs_conn = boto3.client("logs", region_name="us-east-1")
|
||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||
queue = sqs.create_queue(QueueName="test-sqs-queue1")
|
||||
|
||||
conn = boto3.client("lambda")
|
||||
conn = boto3.client("lambda", region_name="us-east-1")
|
||||
func = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
|
|
@ -1054,7 +1054,7 @@ def test_invoke_function_from_sqs():
|
|||
assert response["EventSourceArn"] == queue.attributes["QueueArn"]
|
||||
assert response["State"] == "Enabled"
|
||||
|
||||
sqs_client = boto3.client("sqs")
|
||||
sqs_client = boto3.client("sqs", region_name="us-east-1")
|
||||
sqs_client.send_message(QueueUrl=queue.url, MessageBody="test")
|
||||
start = time.time()
|
||||
while (time.time() - start) < 30:
|
||||
|
|
@ -1081,8 +1081,8 @@ def test_invoke_function_from_sqs():
|
|||
@mock_lambda
|
||||
@mock_dynamodb2
|
||||
def test_invoke_function_from_dynamodb():
|
||||
logs_conn = boto3.client("logs")
|
||||
dynamodb = boto3.client("dynamodb")
|
||||
logs_conn = boto3.client("logs", region_name="us-east-1")
|
||||
dynamodb = boto3.client("dynamodb", region_name="us-east-1")
|
||||
table_name = "table_with_stream"
|
||||
table = dynamodb.create_table(
|
||||
TableName=table_name,
|
||||
|
|
@ -1094,7 +1094,7 @@ def test_invoke_function_from_dynamodb():
|
|||
},
|
||||
)
|
||||
|
||||
conn = boto3.client("lambda")
|
||||
conn = boto3.client("lambda", region_name="us-east-1")
|
||||
func = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
|
|
@ -1141,11 +1141,11 @@ def test_invoke_function_from_dynamodb():
|
|||
@mock_lambda
|
||||
@mock_sqs
|
||||
def test_invoke_function_from_sqs_exception():
|
||||
logs_conn = boto3.client("logs")
|
||||
sqs = boto3.resource("sqs")
|
||||
logs_conn = boto3.client("logs", region_name="us-east-1")
|
||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||
queue = sqs.create_queue(QueueName="test-sqs-queue1")
|
||||
|
||||
conn = boto3.client("lambda")
|
||||
conn = boto3.client("lambda", region_name="us-east-1")
|
||||
func = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
|
|
@ -1201,10 +1201,10 @@ def test_invoke_function_from_sqs_exception():
|
|||
@mock_lambda
|
||||
@mock_sqs
|
||||
def test_list_event_source_mappings():
|
||||
sqs = boto3.resource("sqs")
|
||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||
queue = sqs.create_queue(QueueName="test-sqs-queue1")
|
||||
|
||||
conn = boto3.client("lambda")
|
||||
conn = boto3.client("lambda", region_name="us-east-1")
|
||||
func = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
|
|
@ -1233,10 +1233,10 @@ def test_list_event_source_mappings():
|
|||
@mock_lambda
|
||||
@mock_sqs
|
||||
def test_get_event_source_mapping():
|
||||
sqs = boto3.resource("sqs")
|
||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||
queue = sqs.create_queue(QueueName="test-sqs-queue1")
|
||||
|
||||
conn = boto3.client("lambda")
|
||||
conn = boto3.client("lambda", region_name="us-east-1")
|
||||
func = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
|
|
@ -1263,10 +1263,10 @@ def test_get_event_source_mapping():
|
|||
@mock_lambda
|
||||
@mock_sqs
|
||||
def test_update_event_source_mapping():
|
||||
sqs = boto3.resource("sqs")
|
||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||
queue = sqs.create_queue(QueueName="test-sqs-queue1")
|
||||
|
||||
conn = boto3.client("lambda")
|
||||
conn = boto3.client("lambda", region_name="us-east-1")
|
||||
func1 = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
|
|
@ -1307,10 +1307,10 @@ def test_update_event_source_mapping():
|
|||
@mock_lambda
|
||||
@mock_sqs
|
||||
def test_delete_event_source_mapping():
|
||||
sqs = boto3.resource("sqs")
|
||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||
queue = sqs.create_queue(QueueName="test-sqs-queue1")
|
||||
|
||||
conn = boto3.client("lambda")
|
||||
conn = boto3.client("lambda", region_name="us-east-1")
|
||||
func1 = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue