Beispiel #1
0
 def test_execute_with_action(self):
     context = Context('name', initial_user_context={'foo': 'bar'})
     self.assertEqual(None, context.current_state)
     action = mock.Mock()
     t = Transition('name', 'target', action=action)
     t.execute(context, 'obj')
     self.assertEqual('target', context.current_state)
     action.execute.assert_called_with({'foo': 'bar'}, 'obj')
Beispiel #2
0
 def test_execute_no_action(self):
     context = Context('name')
     self.assertEqual(None, context.current_state)
     t = Transition('name', 'target')
     t.execute(context, None)
     self.assertEqual('target', context.current_state)