示例#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)
示例#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')
示例#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)
示例#4
0
 def test_get_non_existing_unaction_should_raise_keyerror(self):
     with self.assertRaises(KeyError):
         get_unaction('almost-an-action')
示例#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))