SFN - fix InvalidARN exception on start_execution (#3007)

This commit is contained in:
Aidan Rowe 2020-05-25 00:06:02 +10:00 committed by GitHub
parent 2320e82647
commit 93feeec1b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -95,7 +95,10 @@ class StepFunctionResponse(BaseResponse):
def start_execution(self):
arn = self._get_param("stateMachineArn")
name = self._get_param("name")
execution = self.stepfunction_backend.start_execution(arn, name)
try:
execution = self.stepfunction_backend.start_execution(arn, name)
except AWSError as err:
return err.response()
response = {
"executionArn": execution.execution_arn,
"startDate": execution.start_date,

View File

@ -253,6 +253,15 @@ def test_state_machine_throws_error_when_describing_unknown_machine():
client.describe_state_machine(stateMachineArn=unknown_state_machine)
@mock_stepfunctions
@mock_sts
def test_state_machine_throws_error_when_describing_bad_arn():
client = boto3.client("stepfunctions", region_name=region)
#
with assert_raises(ClientError) as exc:
client.describe_state_machine(stateMachineArn="bad")
@mock_stepfunctions
@mock_sts
def test_state_machine_throws_error_when_describing_machine_in_different_account():
@ -362,6 +371,15 @@ def test_state_machine_start_execution():
execution["startDate"].should.be.a(datetime)
@mock_stepfunctions
@mock_sts
def test_state_machine_start_execution_bad_arn_raises_exception():
client = boto3.client("stepfunctions", region_name=region)
#
with assert_raises(ClientError) as exc:
client.start_execution(stateMachineArn="bad")
@mock_stepfunctions
@mock_sts
def test_state_machine_start_execution_with_custom_name():
@ -446,7 +464,7 @@ def test_state_machine_describe_execution():
@mock_stepfunctions
@mock_sts
def test_state_machine_throws_error_when_describing_unknown_machine():
def test_execution_throws_error_when_describing_unknown_execution():
client = boto3.client("stepfunctions", region_name=region)
#
with assert_raises(ClientError) as exc: