Exemplo n.º 1
0
    def test_is_triggered_true_with_trigger(self):
        current_state = MagicMock()
        source = MagicMock()
        target = MagicMock()
        event = Event('test_event')
        t = Transition(source, target, trigger='test_event')

        r = t.is_triggered(event)

        self.assertTrue( r )
Exemplo n.º 2
0
    def test_is_triggered_true_with_trigger(self):
        current_state = MagicMock()
        source = MagicMock()
        target = MagicMock()
        event = Event('test_event')
        t = Transition(source, target, trigger='test_event')

        r = t.is_triggered(event)

        self.assertTrue(r)
Exemplo n.º 3
0
    def test_is_triggered_false_with_guard(self):

        current_state = MagicMock()
        source = MagicMock()
        target = MagicMock()
        event = MagicMock()
        guard = lambda event, current_state:False
        t = Transition(source, target, guard=guard)

        r = t.is_triggered(event)

        self.assertFalse( r )
Exemplo n.º 4
0
    def test_is_triggered_false_with_guard(self):

        current_state = MagicMock()
        source = MagicMock()
        target = MagicMock()
        event = MagicMock()
        guard = lambda event, current_state: False
        t = Transition(source, target, guard=guard)

        r = t.is_triggered(event)

        self.assertFalse(r)