mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 04:20:12 +03:00
Add test for wrapped request instance
This commit is contained in:
parent
d71bd57b64
commit
a60a1781e5
|
@ -25,6 +25,18 @@ from rest_framework.views import APIView
|
||||||
factory = APIRequestFactory()
|
factory = APIRequestFactory()
|
||||||
|
|
||||||
|
|
||||||
|
class TestInitializer(TestCase):
|
||||||
|
def test_request_type(self):
|
||||||
|
request = Request(factory.get('/'))
|
||||||
|
|
||||||
|
message = (
|
||||||
|
'The `request` argument must be an instance of '
|
||||||
|
'`django.http.HttpRequest`, not `rest_framework.request.Request`.'
|
||||||
|
)
|
||||||
|
with self.assertRaisesMessage(AssertionError, message):
|
||||||
|
Request(request)
|
||||||
|
|
||||||
|
|
||||||
class PlainTextParser(BaseParser):
|
class PlainTextParser(BaseParser):
|
||||||
media_type = 'text/plain'
|
media_type = 'text/plain'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user