File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,8 @@ live environment. (See "Live tests" below.)
201
201
This exposes exactly the same interface as if you were using a requests session
202
202
directly.
203
203
204
+ from rest_framework.test import RequestsClient
205
+
204
206
client = RequestsClient()
205
207
response = client.get('http://testserver/users/')
206
208
assert response.status_code == 200
@@ -237,12 +239,12 @@ For example...
237
239
client = RequestsClient()
238
240
239
241
# Obtain a CSRF token.
240
- response = client.get('/homepage/')
242
+ response = client.get('http://testserver /homepage/')
241
243
assert response.status_code == 200
242
244
csrftoken = response.cookies['csrftoken']
243
245
244
246
# Interact with the API.
245
- response = client.post('/organisations/', json={
247
+ response = client.post('http://testserver /organisations/', json={
246
248
'name': 'MegaCorp',
247
249
'status': 'active'
248
250
}, headers={'X-CSRFToken': csrftoken})
You can’t perform that action at this time.
0 commit comments