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