MCPcopy Index your code
hub / github.com/encode/django-rest-framework / test_post_root_view

Method test_post_root_view

tests/test_generics.py:113–124  ·  view source on GitHub ↗

POST requests to ListCreateAPIView should create a new object.

(self)

Source from the content-addressed store, hash-verified

111 assert response.status_code == status.HTTP_200_OK
112
113 def test_post_root_view(self):
114 """
115 POST requests to ListCreateAPIView should create a new object.
116 """
117 data = {'text': 'foobar'}
118 request = factory.post('/', data, format='json')
119 with self.assertNumQueries(1):
120 response = self.view(request).render()
121 assert response.status_code == status.HTTP_201_CREATED
122 assert response.data == {'id': 4, 'text': 'foobar'}
123 created = self.objects.get(id=4)
124 assert created.text == 'foobar'
125
126 def test_put_root_view(self):
127 """

Callers

nothing calls this directly

Calls 4

postMethod · 0.45
renderMethod · 0.45
viewMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected