def test_serializer_for_nonexistent(self): """Tests that attempting to get the serializer for an unknown model yields an error. """ with self.assertRaises(ValueError): serializer_for(self.Person)
def test_serializer_for(self): """Tests the global :func:`flask_restless.serializer_for` function. """ def my_function(*args, **kw): pass self.manager.create_api(self.Person, serializer=my_function) assert serializer_for(self.Person) == my_function
def test_serializer_for(self): """Tests the global :func:`flask_restless.serializer_for` function. """ class MySerializer(DefaultSerializer): pass self.manager.create_api(self.Person, serializer_class=MySerializer) assert isinstance(serializer_for(self.Person), MySerializer)