mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Add test for filter_renderers
This commit is contained in:
parent
46210205a4
commit
076ca6e765
|
@ -1,5 +1,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from django.http import Http404
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from rest_framework.negotiation import DefaultContentNegotiation
|
from rest_framework.negotiation import DefaultContentNegotiation
|
||||||
|
@ -78,3 +80,10 @@ class TestAcceptedMediaType(TestCase):
|
||||||
params_str += '; %s=%s' % (key, val)
|
params_str += '; %s=%s' % (key, val)
|
||||||
expected = 'test/*' + params_str
|
expected = 'test/*' + params_str
|
||||||
assert str(mediatype) == expected
|
assert str(mediatype) == expected
|
||||||
|
|
||||||
|
def test_raise_error_if_no_suitable_renderers_found(self):
|
||||||
|
class MockRenderer(object):
|
||||||
|
format = 'xml'
|
||||||
|
renderers = [MockRenderer()]
|
||||||
|
with pytest.raises(Http404):
|
||||||
|
self.negotiator.filter_renderers(renderers, format='json')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user