示例#1
0
    def test_get_next_step(self):
        flag = Flag(action='regMatch', args={'regex': 'aaa'})
        next_step = NextStep(name='next', flags=[flag], status='Success')
        step = Step('HelloWorld', 'helloWorld', next_steps=[next_step])
        step._output = ActionResult(result='aaa', status='Success')

        result = {'triggered': False}

        @callbacks.data_sent.connect
        def validate_sent_data(sender, **kwargs):
            if isinstance(sender, Step):
                self.assertIs(sender, step)
                self.assertIn('callback_name', kwargs)
                self.assertEqual(kwargs['callback_name'],
                                 'Conditionals Executed')
                self.assertIn('object_type', kwargs)
                self.assertEqual(kwargs['object_type'], 'Step')
                result['triggered'] = True

        self.assertEqual(step.get_next_step({}), 'next')
        self.assertEqual(step._next_up, 'next')
        self.assertTrue(result['triggered'])
示例#2
0
 def test_get_next_step_invalid_step(self):
     flag = Flag(action='regMatch', args={'regex': 'aaa'})
     next_step = NextStep(name='next', flags=[flag], status='Success')
     step = Step('HelloWorld', 'helloWorld', next_steps=[next_step])
     step._output = ActionResult(result='bbb', status='Success')
     self.assertIsNone(step.get_next_step({}))
示例#3
0
 def test_get_next_step_no_next_steps(self):
     step = Step('HelloWorld', 'helloWorld')
     self.assertIsNone(step.get_next_step({}))