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
c4459167
Commit
c4459167
authored
Mar 07, 2014
by
Xavier Ordoquy
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1463 from linovia/bugfix/old_request_factory_url_arguments
Reintroduced url arguments in the urls for the tests.
parents
6cf19fa4
0e677e9d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
rest_framework/test.py
+4
-0
rest_framework/tests/test_testing.py
+10
-0
No files found.
rest_framework/test.py
View file @
c4459167
...
...
@@ -76,6 +76,10 @@ class APIRequestFactory(DjangoRequestFactory):
r
=
{
'QUERY_STRING'
:
urlencode
(
data
or
{},
doseq
=
True
),
}
# Fix to support old behavior where you have the arguments in the url
# See #1461
if
not
data
and
'?'
in
path
:
r
[
'QUERY_STRING'
]
=
path
.
split
(
'?'
)[
1
]
r
.
update
(
extra
)
return
self
.
generic
(
'GET'
,
path
,
**
r
)
...
...
rest_framework/tests/test_testing.py
View file @
c4459167
...
...
@@ -152,3 +152,13 @@ class TestAPIRequestFactory(TestCase):
simple_png
.
name
=
'test.png'
factory
=
APIRequestFactory
()
factory
.
post
(
'/'
,
data
=
{
'image'
:
simple_png
})
def
test_request_factory_url_arguments
(
self
):
"""
This is a non regression test against #1461
"""
factory
=
APIRequestFactory
()
request
=
factory
.
get
(
'/view/?demo=test'
)
self
.
assertEqual
(
dict
(
request
.
GET
),
{
'demo'
:
[
'test'
]})
request
=
factory
.
get
(
'/view/'
,
{
'demo'
:
'test'
})
self
.
assertEqual
(
dict
(
request
.
GET
),
{
'demo'
:
[
'test'
]})
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