Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
f7db0695
Commit
f7db0695
authored
Jun 29, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unneeded tests.utils, superseeded by APIRequestFactory, APIClient
parent
90bc07f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
40 deletions
+0
-40
rest_framework/tests/utils.py
+0
-40
No files found.
rest_framework/tests/utils.py
deleted
100644 → 0
View file @
90bc07f3
from
__future__
import
unicode_literals
from
django.test.client
import
FakePayload
,
Client
as
_Client
,
RequestFactory
as
_RequestFactory
from
django.test.client
import
MULTIPART_CONTENT
from
rest_framework.compat
import
urlparse
class
RequestFactory
(
_RequestFactory
):
def
__init__
(
self
,
**
defaults
):
super
(
RequestFactory
,
self
)
.
__init__
(
**
defaults
)
def
patch
(
self
,
path
,
data
=
{},
content_type
=
MULTIPART_CONTENT
,
**
extra
):
"Construct a PATCH request."
patch_data
=
self
.
_encode_data
(
data
,
content_type
)
parsed
=
urlparse
.
urlparse
(
path
)
r
=
{
'CONTENT_LENGTH'
:
len
(
patch_data
),
'CONTENT_TYPE'
:
content_type
,
'PATH_INFO'
:
self
.
_get_path
(
parsed
),
'QUERY_STRING'
:
parsed
[
4
],
'REQUEST_METHOD'
:
'PATCH'
,
'wsgi.input'
:
FakePayload
(
patch_data
),
}
r
.
update
(
extra
)
return
self
.
request
(
**
r
)
class
Client
(
_Client
,
RequestFactory
):
def
patch
(
self
,
path
,
data
=
{},
content_type
=
MULTIPART_CONTENT
,
follow
=
False
,
**
extra
):
"""
Send a resource to the server using PATCH.
"""
response
=
super
(
Client
,
self
)
.
patch
(
path
,
data
=
data
,
content_type
=
content_type
,
**
extra
)
if
follow
:
response
=
self
.
_handle_redirects
(
response
,
**
extra
)
return
response
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment