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
a51c0af4
Commit
a51c0af4
authored
Feb 03, 2017
by
muzaffaryousaf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating test for case insensitive search.
parent
feb533fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
notesapi/v1/tests/test_views.py
+9
-9
No files found.
notesapi/v1/tests/test_views.py
View file @
a51c0af4
...
...
@@ -654,7 +654,7 @@ class AnnotationSearchViewTests(BaseAnnotationViewTests):
def
test_search
(
self
):
"""
Tests for search method.
Tests for search method
with case insensitivity for text param
.
"""
self
.
_create_annotation
(
text
=
u'First one'
,
tags
=
[])
self
.
_create_annotation
(
text
=
u'Second note'
,
tags
=
[
u'tag1'
,
u'tag2'
])
...
...
@@ -669,16 +669,17 @@ class AnnotationSearchViewTests(BaseAnnotationViewTests):
self
.
assertEqual
(
last_note
,
note
)
self
.
assertEqual
(
results
[
'total'
],
3
)
def
search_and_verify
(
search
Text
,
expectedText
,
expectedT
ags
):
def
search_and_verify
(
search
_text
,
expected_text
,
expected_t
ags
):
""" Test the results from a specific text search operation """
results
=
self
.
_get_search_results
(
text
=
search
T
ext
)
results
=
self
.
_get_search_results
(
text
=
search
_t
ext
)
self
.
assertEqual
(
results
[
'total'
],
1
)
self
.
assertEqual
(
len
(
results
[
'rows'
]),
1
)
self
.
assertEqual
(
results
[
'rows'
][
0
][
'text'
],
expected
T
ext
)
self
.
assertEqual
(
results
[
'rows'
][
0
][
'tags'
],
expected
T
ags
)
self
.
assertEqual
(
results
[
'rows'
][
0
][
'text'
],
expected
_t
ext
)
self
.
assertEqual
(
results
[
'rows'
][
0
][
'tags'
],
expected
_t
ags
)
search_and_verify
(
"First"
,
"First one"
,
[])
search_and_verify
(
"Second"
,
"Second note"
,
[
"tag1"
,
"tag2"
])
search_and_verify
(
search_text
=
"First"
,
expected_text
=
"First one"
,
expected_tags
=
[])
search_and_verify
(
search_text
=
"first"
,
expected_text
=
"First one"
,
expected_tags
=
[])
search_and_verify
(
search_text
=
"Second"
,
expected_text
=
"Second note"
,
expected_tags
=
[
"tag1"
,
"tag2"
])
@ddt.data
(
True
,
False
)
def
test_usage_id_search
(
self
,
is_es_disabled
):
...
...
@@ -859,12 +860,11 @@ class AnnotationSearchViewTests(BaseAnnotationViewTests):
self
.
assertEqual
(
self
.
_get_search_results
(
text
=
u"something"
)[
'total'
],
1
)
self
.
assertEqual
(
self
.
_get_search_results
(
text
=
u"totally different"
)[
'total'
],
1
)
def
test_search_
course
(
self
):
def
test_search_
by_course_id
(
self
):
"""
Tests searching with course_id provided
"""
self
.
_create_annotation
(
text
=
u'First one'
,
course_id
=
"u'edX/DemoX/Demo_Course'"
)
self
.
_create_annotation
(
text
=
u'Not shown'
,
course_id
=
"u'edx/demox/demo_course'"
)
# wrong case
self
.
_create_annotation
(
text
=
u'Second note'
,
course_id
=
"u'edX/DemoX/Demo_Course'"
)
self
.
_create_annotation
(
text
=
u'Third note'
,
course_id
=
"b"
)
self
.
_create_annotation
(
text
=
u'Fourth note'
,
course_id
=
"c"
)
...
...
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