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
ed70f563
Commit
ed70f563
authored
May 11, 2017
by
vimarshc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added failing test case for multiple hyphens in orderingfilter paramter
parent
69b0ac52
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
tests/test_filters.py
+16
-0
No files found.
tests/test_filters.py
View file @
ed70f563
...
...
@@ -764,6 +764,22 @@ class OrderingFilterTests(TestCase):
{
'id'
:
1
,
'title'
:
'zyx'
,
'text'
:
'abc'
},
]
def
test_incorrecturl_extrahyphens_ordering
(
self
):
class
OrderingListView
(
generics
.
ListAPIView
):
queryset
=
OrderingFilterModel
.
objects
.
all
()
serializer_class
=
OrderingFilterSerializer
filter_backends
=
(
filters
.
OrderingFilter
,)
ordering
=
(
'title'
,)
ordering_fields
=
(
'text'
,)
view
=
OrderingListView
.
as_view
()
request
=
factory
.
get
(
'/'
,
{
'ordering'
:
'--text'
})
response
=
view
(
request
)
assert
response
.
data
==
[
{
'id'
:
3
,
'title'
:
'xwv'
,
'text'
:
'cde'
},
{
'id'
:
2
,
'title'
:
'yxw'
,
'text'
:
'bcd'
},
{
'id'
:
1
,
'title'
:
'zyx'
,
'text'
:
'abc'
},
]
def
test_incorrectfield_ordering
(
self
):
class
OrderingListView
(
generics
.
ListAPIView
):
queryset
=
OrderingFilterModel
.
objects
.
all
()
...
...
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