Exemplo n.º 1
0
def _get_unaction_from_definition(action_def: dict) -> Tuple[Any, dict, str]:
    key = _get_action_key_from_definition(action_def)
    return (get_unaction(key), action_def[key], key)
Exemplo n.º 2
0
 def test_unaction_is_case_sensitive(self):
     with self.assertRaises(KeyError):
         get_unaction('Very-Specific-Action')
     with self.assertRaises(KeyError):
         get_unaction('Very-Specific-Action-With-No-Unaction')
Exemplo n.º 3
0
    def test_get_existing_action_but_without_unaction_should_return_the_none(
            self):
        res = get_unaction('very-specific-action-with-no-unaction')

        self.assertIsNone(res)
Exemplo n.º 4
0
 def test_get_non_existing_unaction_should_raise_keyerror(self):
     with self.assertRaises(KeyError):
         get_unaction('almost-an-action')
Exemplo n.º 5
0
    def test_get_existing_unaction_should_return_the_function(self):
        res = get_unaction('very-specific-action')

        self.assertTrue(callable(res))
        self.assertEqual('yes', res(None, None))