File: test_choice_state.py

package info (click to toggle)
python-moto 5.1.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 116,520 kB
  • sloc: python: 636,725; javascript: 181; makefile: 39; sh: 3
file content (36 lines) | stat: -rw-r--r-- 1,113 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import json
from unittest import SkipTest

from moto import mock_aws, settings

from . import aws_verified, verify_execution_result


@mock_aws(config={"stepfunctions": {"execute_state_machine": True}})
def test_state_machine_with_choice():
    if settings.TEST_SERVER_MODE:
        raise SkipTest("Don't need to test this in ServerMode")
    tmpl_name = "choice_state_singleton"
    exec_input = {"type": "Public"}

    def _verify_result(client, execution, execution_arn):
        assert json.loads(execution["input"]) == exec_input

    verify_execution_result(
        _verify_result, "SUCCEEDED", tmpl_name, exec_input=json.dumps(exec_input)
    )


@aws_verified
def test_state_machine_with_choice_miss():
    if settings.TEST_SERVER_MODE:
        raise SkipTest("Don't need to test this in ServerMode")
    tmpl_name = "choice_state_singleton"
    exec_input = {"type": "Private"}

    def _verify_result(client, execution, execution_arn):
        assert execution["cause"] == "No Matches!"

    verify_execution_result(
        _verify_result, "FAILED", tmpl_name, exec_input=json.dumps(exec_input)
    )