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
7218bcba
Commit
7218bcba
authored
Oct 05, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for non-GET methods to api_view decorator
parent
2a89cb4f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletions
+16
-1
rest_framework/fields.py
+2
-1
rest_framework/tests/decorators.py
+14
-0
No files found.
rest_framework/fields.py
View file @
7218bcba
...
...
@@ -379,7 +379,8 @@ class HyperlinkedIdentityField(Field):
A field that represents the model's identity using a hyperlink.
"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
# TODO: Make this mandatory
# TODO: Make this mandatory, and have the HyperlinkedModelSerializer
# set it on-the-fly
self
.
view_name
=
kwargs
.
pop
(
'view_name'
,
None
)
super
(
HyperlinkedIdentityField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
...
...
rest_framework/tests/decorators.py
View file @
7218bcba
...
...
@@ -49,6 +49,20 @@ class DecoratorTestCase(TestCase):
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
405
)
def
test_calling_put_method
(
self
):
@api_view
([
'GET'
,
'PUT'
])
def
view
(
request
):
return
Response
({})
request
=
self
.
factory
.
put
(
'/'
)
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
200
)
request
=
self
.
factory
.
post
(
'/'
)
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
405
)
def
test_renderer_classes
(
self
):
@api_view
([
'GET'
])
...
...
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