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
5e2d8052
Commit
5e2d8052
authored
May 12, 2013
by
Marlon Bailey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test case to work with Python 3 and make it more explicit
parent
9d2580dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
rest_framework/tests/routers.py
+14
-5
No files found.
rest_framework/tests/routers.py
View file @
5e2d8052
...
@@ -38,9 +38,18 @@ class TestSimpleRouter(TestCase):
...
@@ -38,9 +38,18 @@ class TestSimpleRouter(TestCase):
def
test_link_and_action_decorator
(
self
):
def
test_link_and_action_decorator
(
self
):
routes
=
self
.
router
.
get_routes
(
BasicViewSet
)
routes
=
self
.
router
.
get_routes
(
BasicViewSet
)
# Should be 2 by default, and then four from the @action and @link combined
#self.assertEqual(len(routes), 6)
#
decorator_routes
=
routes
[
2
:]
decorator_routes
=
routes
[
2
:]
for
i
,
method
in
enumerate
([
'action1'
,
'action2'
,
'link1'
,
'link2'
]):
# Make sure all these endpoints exist and none have been clobbered
self
.
assertEqual
(
decorator_routes
[
i
]
.
mapping
.
values
()[
0
],
method
)
for
i
,
endpoint
in
enumerate
([
'action1'
,
'action2'
,
'link1'
,
'link2'
]):
route
=
decorator_routes
[
i
]
# check url listing
self
.
assertEqual
(
route
.
url
,
'^{{prefix}}/{{lookup}}/{0}/$'
.
format
(
endpoint
))
# check method to function mapping
if
endpoint
.
startswith
(
'action'
):
method_map
=
'post'
else
:
method_map
=
'get'
self
.
assertEqual
(
route
.
mapping
[
method_map
],
endpoint
)
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