Example #1
0
    def test_single_state(self):
        self.maxDiff = None
        output = '''
            {
                "Comment": "A simple minimal example of the States language",
                "StartAt": "Hello World",
                "States": {
                    "Hello World": { 
                        "Type": "Task",
                        "Resource": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
                        "Next": "nextResource"
                    }
                }
            }
        '''
        #compress and remove whitespace
        output = json.dumps(json.loads(output))
        ss = StairStep(
            comment="A simple minimal example of the States language",
            startAt="Hello World",
        )
        hello_step = StateTask(
            name="Hello World",
            resource=
            "arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
            snext="nextResource")

        ss.addState(hello_step)
        self.assertEqual(output, ss.json())
Example #2
0
 def setUp(self):
     self.ss = StairStep(
         comment="A simple minimal example of the States language",
         startAt="HelloWorld",
     )
     self.state = StatePass(name="HelloWorld",
                            comment="Pass State example",
                            end=True)
     self.ss.addState(self.state)
Example #3
0
 def setUp(self):
     self.ss = StairStep(
         comment="A simple minimal example of the States language",
         startAt="HelloWorld",
     )
     self.state = StateSucceed(
         name="HelloWorld",
         comment="Succeed State example",
     )
     self.ss.addState(self.state)
Example #4
0
 def setUp(self):
     self.ss = StairStep(
         comment="A simple minimal example of the States language",
         startAt="HelloWorld",
     )
     self.state = StateTask(
         name="HelloWorld",
         comment="Task State example",
         resource="arn:aws:swf:us-east-1:123456789012:task:HelloWorld",
         end=True)
     self.ss.addState(self.state)
Example #5
0
    def setUp(self):
        self.maxDiff = None
        self.ss = StairStep(
            comment = "Example Choice State",
            startAt = "ChoiceStateX"
        )
        typeNotPrivate = ChoiceRule(operator="Not", snext="Public", conditions=
                            ChoiceExpression(operator="StringEquals", variable="$.type", value="Private")
                         )

        valueInTwenties = ChoiceRule(operator="And", snext="ValueInTwenties", conditions=[
                            ChoiceExpression(operator="NumericGreaterThanEquals", variable="$.value", value=20),
                            ChoiceExpression(operator="NumericLessThan", variable="$.value", value=30)]
                        )
    
        self.state = StateChoice(
            name    = "ChoiceStateX",
            choices = [typeNotPrivate, valueInTwenties],
            default = "DefaultState"
        )
        self.ss.addState(self.state)
Example #6
0
    def test_single_state_comment_optional(self):
        output = '''{
                        "StartAt": "Hello World",
                        "States": {
                            "Hello World": { 
                                "Type": "Succeed",
                                "Resource": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
                                "Next" : "nextResource"
                            }
                        }
                    }'''
        #compress and remove whitespace
        output = json.dumps(json.loads(output))
        ss = StairStep(startAt="Hello World", )
        hello_step = StateSucceed(
            name="Hello World",
            resource=
            "arn:aws:lambda:us-east-1:123456789012:function:HelloWorld",
            snext="nextResource")

        ss.addState(hello_step)
        self.assertEqual(output, ss.json())
Example #7
0
 def setUp(self):
     self.ss = StairStep(
         comment="A simple minimal example of the States language",
         startAt="HelloWorld",
     )
Example #8
0
 def test_base_object(self):
     ss = StairStep()
     self.assertIsInstance(ss, StairStep)