Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
9aed148d
Commit
9aed148d
authored
May 09, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add search test
parent
aad5096c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
3 deletions
+44
-3
lms/djangoapps/notes/tests.py
+44
-3
No files found.
lms/djangoapps/notes/tests.py
View file @
9aed148d
...
@@ -294,6 +294,47 @@ class ApiTest(TestCase):
...
@@ -294,6 +294,47 @@ class ApiTest(TestCase):
for
field
in
[
'text'
,
'tags'
]:
for
field
in
[
'text'
,
'tags'
]:
self
.
assertEqual
(
actual_dict
[
field
],
updated_dict
[
field
])
self
.
assertEqual
(
actual_dict
[
field
],
updated_dict
[
field
])
@unittest.skip
(
"skipping search test stub"
)
def
test_search_note_params
(
self
):
def
test_search_note
(
self
):
self
.
login
()
pass
total
=
3
notes
=
self
.
create_notes
(
total
)
invalid_uri
=
''
.
join
([
note
.
uri
for
note
in
notes
])
tests
=
[{
'limit'
:
0
,
'offset'
:
0
,
'expected_rows'
:
total
},
{
'limit'
:
0
,
'offset'
:
2
,
'expected_rows'
:
total
-
2
},
{
'limit'
:
0
,
'offset'
:
total
,
'expected_rows'
:
0
},
{
'limit'
:
1
,
'offset'
:
0
,
'expected_rows'
:
1
},
{
'limit'
:
2
,
'offset'
:
0
,
'expected_rows'
:
2
},
{
'limit'
:
total
,
'offset'
:
2
,
'expected_rows'
:
1
},
{
'limit'
:
total
,
'offset'
:
total
,
'expected_rows'
:
0
},
{
'limit'
:
total
+
1
,
'offset'
:
total
+
1
,
'expected_rows'
:
0
},
{
'limit'
:
total
+
1
,
'offset'
:
0
,
'expected_rows'
:
total
},
{
'limit'
:
0
,
'offset'
:
0
,
'uri'
:
invalid_uri
,
'expected_rows'
:
0
,
'expected_total'
:
0
}]
for
test
in
tests
:
params
=
dict
([(
k
,
str
(
test
[
k
]))
for
k
in
(
'limit'
,
'offset'
,
'uri'
)
if
k
in
test
])
resp
=
self
.
client
.
get
(
self
.
url
(
'notes_api_search'
),
params
,
content_type
=
'application/json'
,
HTTP_X_REQUESTED_WITH
=
'XMLHttpRequest'
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertNotEqual
(
resp
.
content
,
''
)
content
=
json
.
loads
(
resp
.
content
)
for
expected_key
in
(
'total'
,
'rows'
):
self
.
assertTrue
(
expected_key
in
content
)
if
'expected_total'
in
test
:
self
.
assertEqual
(
content
[
'total'
],
test
[
'expected_total'
])
else
:
self
.
assertEqual
(
content
[
'total'
],
total
)
self
.
assertEqual
(
len
(
content
[
'rows'
]),
test
[
'expected_rows'
])
for
row
in
content
[
'rows'
]:
self
.
assertTrue
(
'id'
in
row
)
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