def test_hook_serialize_hook(self): class TestClass(object): def serialize_hook(self, hook): return 'RETURNED' test_class = TestClass() self.assertEqual(utils.serialize_hook(test_class), 'RETURNED')
def test_custom_serializer(self): test_class = hook_models.Hook() test_class.dict = dict ret = utils.serialize_hook(test_class) self.assertEqual(ret, 'CUSTOM_SERIALIZER_CALLED')
def test_serialize_hook_no_serialize_hook_method(self): def dict(): return 'DICT_TEST' test_class = hook_models.Hook() test_class.dict = dict # self.fail(utils.serialize_hook(test_class)) self.assertEqual(utils.serialize_hook(test_class)['hook'], 'DICT_TEST')