Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-notes-api
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
edx-notes-api
Commits
0ed256a7
Commit
0ed256a7
authored
Mar 03, 2016
by
muzaffaryousaf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding test for long text
parent
d25053ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
notesapi/v1/tests/test_views.py
+30
-0
No files found.
notesapi/v1/tests/test_views.py
View file @
0ed256a7
...
@@ -717,6 +717,36 @@ class AnnotationSearchViewTests(BaseAnnotationViewTests):
...
@@ -717,6 +717,36 @@ class AnnotationSearchViewTests(BaseAnnotationViewTests):
'{elasticsearch_highlight_start}First{elasticsearch_highlight_end} note'
'{elasticsearch_highlight_start}First{elasticsearch_highlight_end} note'
)
)
@unittest.skipIf
(
settings
.
ES_DISABLED
,
"MySQL does not do highlighing"
)
def
test_search_highlight_with_long_text
(
self
):
"""
Tests highlighting with long text.
"""
text
=
"Lorem "
+
"word "
*
100
+
" Lorem"
start_tag
=
"{elasticsearch_highlight_start}"
end_tag
=
"{elasticsearch_highlight_end}"
expected_text
=
"{start_tag}Lorem{end_tag} {word} {start_tag}Lorem{end_tag}"
.
format
(
start_tag
=
start_tag
,
end_tag
=
end_tag
,
word
=
"word "
*
100
)
self
.
_create_annotation
(
text
=
text
)
self
.
_create_annotation
(
text
=
u'Second note'
)
results
=
self
.
_get_search_results
()
self
.
assertEqual
(
results
[
'total'
],
2
)
results
=
self
.
_get_search_results
(
text
=
"Lorem"
,
highlight
=
True
)
self
.
assertEqual
(
results
[
'total'
],
1
)
self
.
assertEqual
(
len
(
results
[
'rows'
]),
1
)
self
.
assertEqual
(
results
[
'rows'
][
0
][
'text'
],
expected_text
)
@override_settings
(
ES_DISABLED
=
True
)
@override_settings
(
ES_DISABLED
=
True
)
def
test_search_ordering_in_db
(
self
):
def
test_search_ordering_in_db
(
self
):
"""
"""
...
...
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