'Confirm that an Api can use a custom serializer'

def test_custom_api_serializer(self):

    class JSONSerializer(Serializer, ):
        formats = ('json',)
    api = Api(serializer_class=JSONSerializer)
    api.register(NoteResource())
    request = HttpRequest()
    request.META = {'HTTP_ACCEPT': 'text/javascript'}
    resp = api.top_level(request)
    self.assertEqual(resp.status_code, 200)
    self.assertEqual(resp['content-type'], 'application/json', msg=('Expected    application/json    response    but    received    %s' % resp['content-type']))
    request = HttpRequest()
    request.META = {'HTTP_ACCEPT': 'application/xml'}
    resp = api.top_level(request)
    self.assertEqual(resp.status_code, 200)
    self.assertEqual(resp['content-type'], 'application/json', msg=('Expected    application/json    response    but    received    %s' % resp['content-type']))
