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
46210205
Commit
46210205
authored
Jan 18, 2017
by
Artem Muterko
Committed by
Tom Christie
Jan 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for some template tags (#4815)
parent
a8534baa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletions
+23
-1
tests/test_templatetags.py
+23
-1
No files found.
tests/test_templatetags.py
View file @
46210205
...
...
@@ -5,7 +5,8 @@ from django.test import TestCase
from
rest_framework.relations
import
Hyperlink
from
rest_framework.templatetags.rest_framework
import
(
add_nested_class
,
add_query_param
,
format_value
,
urlize_quoted_links
add_nested_class
,
add_query_param
,
as_string
,
break_long_headers
,
format_value
,
get_pagination_html
,
urlize_quoted_links
)
from
rest_framework.test
import
APIRequestFactory
...
...
@@ -214,6 +215,27 @@ class TemplateTagTests(TestCase):
for
case
in
negative_cases
:
self
.
assertEqual
(
add_nested_class
(
case
),
''
)
def
test_as_string_with_none
(
self
):
result
=
as_string
(
None
)
assert
result
==
''
def
test_get_pagination_html
(
self
):
class
MockPager
(
object
):
def
__init__
(
self
):
self
.
called
=
False
def
to_html
(
self
):
self
.
called
=
True
pager
=
MockPager
()
get_pagination_html
(
pager
)
assert
pager
.
called
is
True
def
test_break_long_lines
(
self
):
header
=
'long test header,'
*
20
expected_header
=
'<br> '
+
', <br>'
.
join
(
header
.
split
(
','
))
assert
break_long_headers
(
header
)
==
expected_header
class
Issue1386Tests
(
TestCase
):
"""
...
...
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