示例#1
0
def test_amazon_sns_request_response():
    expected_task = Task(
        "TestTask",
        Resource="arn:aws:states:::sns:publish",
        Parameters=Parameters(
            TopicArn="arn:aws:sns:us-east-1:123456789012:accretion-notify",
            Message=JsonPath("$.foo.bar")),
    )
    expected = expected_task.to_dict()

    test_task = AmazonSns(
        "TestTask",
        TopicArn="arn:aws:sns:us-east-1:123456789012:accretion-notify",
        Message=JsonPath("$.foo.bar"))
    test = test_task.to_dict()

    assert test == expected
示例#2
0
def test_amazon_sns_callback():
    expected_task = Task(
        "TestTask",
        Resource="arn:aws:states:::sns:publish.waitForTaskToken",
        Parameters=Parameters(
            TopicArn="arn:aws:sns:us-east-1:123456789012:accretion-notify",
            Message=JsonPath("$.foo.bar")),
    )
    expected = expected_task.to_dict()

    test_task = AmazonSns(
        "TestTask",
        Pattern=IntegrationPattern.WAIT_FOR_CALLBACK,
        TopicArn="arn:aws:sns:us-east-1:123456789012:accretion-notify",
        Message=JsonPath("$.foo.bar"),
    )
    test = test_task.to_dict()

    assert test == expected
示例#3
0
def test_aws_lambda_request_response():
    expected_task = Task(
        "TestTask",
        Resource="arn:aws:states:::lambda:invoke",
        Parameters=Parameters(
            FunctionName=
            "arn:aws:lambda:us-east-1:123456789012:function:ship-val",
            Payload=Parameters(test="value")),
    )
    expected = expected_task.to_dict()

    test_task = AwsLambda(
        "TestTask",
        FunctionName="arn:aws:lambda:us-east-1:123456789012:function:ship-val",
        Payload=Parameters(test="value"),
    )
    test = test_task.to_dict()

    assert test == expected
示例#4
0
def test_aws_lambda_callback():
    expected_task = Task(
        "TestTask",
        Resource="arn:aws:states:::lambda:invoke.waitForTaskToken",
        Parameters=Parameters(
            FunctionName=
            "arn:aws:lambda:us-east-1:123456789012:function:ship-val",
            Payload=Parameters(test="value")),
    )
    expected = expected_task.to_dict()

    test_task = AwsLambda(
        "TestTask",
        Pattern=IntegrationPattern.WAIT_FOR_CALLBACK,
        FunctionName="arn:aws:lambda:us-east-1:123456789012:function:ship-val",
        Payload=Parameters(test="value"),
    )
    test = test_task.to_dict()

    assert test == expected