Merge pull request #3286 from ciaranevans/add-input-validation
Add Step Function Execution Input validation
This commit is contained in:
commit
c3b8b2343b
3 changed files with 57 additions and 0 deletions
|
|
@ -425,6 +425,47 @@ def test_state_machine_start_execution_fails_on_duplicate_execution_name():
|
|||
)
|
||||
|
||||
|
||||
@mock_stepfunctions
|
||||
@mock_sts
|
||||
def test_state_machine_start_execution_with_custom_input():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
sm = client.create_state_machine(
|
||||
name="name", definition=str(simple_definition), roleArn=_get_default_role()
|
||||
)
|
||||
execution_input = json.dumps({"input_key": "input_value"})
|
||||
execution = client.start_execution(
|
||||
stateMachineArn=sm["stateMachineArn"], input=execution_input
|
||||
)
|
||||
#
|
||||
execution["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||
uuid_regex = "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
|
||||
expected_exec_name = (
|
||||
"arn:aws:states:"
|
||||
+ region
|
||||
+ ":"
|
||||
+ _get_account_id()
|
||||
+ ":execution:name:"
|
||||
+ uuid_regex
|
||||
)
|
||||
execution["executionArn"].should.match(expected_exec_name)
|
||||
execution["startDate"].should.be.a(datetime)
|
||||
|
||||
|
||||
@mock_stepfunctions
|
||||
@mock_sts
|
||||
def test_state_machine_start_execution_with_invalid_input():
|
||||
client = boto3.client("stepfunctions", region_name=region)
|
||||
#
|
||||
sm = client.create_state_machine(
|
||||
name="name", definition=str(simple_definition), roleArn=_get_default_role()
|
||||
)
|
||||
with assert_raises(ClientError):
|
||||
_ = client.start_execution(stateMachineArn=sm["stateMachineArn"], input="")
|
||||
with assert_raises(ClientError):
|
||||
_ = client.start_execution(stateMachineArn=sm["stateMachineArn"], input="{")
|
||||
|
||||
|
||||
@mock_stepfunctions
|
||||
@mock_sts
|
||||
def test_state_machine_list_executions():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue