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
ea572112
Commit
ea572112
authored
Dec 30, 2015
by
Muhammad Ammar
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #35 from edx/ammar/pagination-fixes-for-annotatorjs
annotatorjs fixes
parents
55467209
39a4c065
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
notesapi/v1/paginators.py
+2
-2
notesapi/v1/tests/test_update_index.py
+7
-7
notesapi/v1/tests/test_views.py
+0
-0
No files found.
notesapi/v1/paginators.py
View file @
ea572112
...
@@ -22,7 +22,7 @@ class NotesPaginator(pagination.PageNumberPagination):
...
@@ -22,7 +22,7 @@ class NotesPaginator(pagination.PageNumberPagination):
'current_page'
:
self
.
page
.
number
,
'current_page'
:
self
.
page
.
number
,
'next'
:
self
.
get_next_link
(),
'next'
:
self
.
get_next_link
(),
'previous'
:
self
.
get_previous_link
(),
'previous'
:
self
.
get_previous_link
(),
'
count
'
:
self
.
page
.
paginator
.
count
,
'
total
'
:
self
.
page
.
paginator
.
count
,
'num_pages'
:
self
.
page
.
paginator
.
num_pages
,
'num_pages'
:
self
.
page
.
paginator
.
num_pages
,
'r
esult
s'
:
data
'r
ow
s'
:
data
})
})
notesapi/v1/tests/test_update_index.py
View file @
ea572112
...
@@ -31,18 +31,18 @@ class UpdateIndexTest(BaseAnnotationViewTests):
...
@@ -31,18 +31,18 @@ class UpdateIndexTest(BaseAnnotationViewTests):
end
=
datetime
.
datetime
.
now
()
end
=
datetime
.
datetime
.
now
()
results
=
self
.
_get_search_results
(
text
=
'note'
)
results
=
self
.
_get_search_results
(
text
=
'note'
)
self
.
assertDictContainsSubset
({
'r
esults'
:
[],
'count
'
:
0
},
results
)
self
.
assertDictContainsSubset
({
'r
ows'
:
[],
'total
'
:
0
},
results
)
# When second note was created.
# When second note was created.
call_command
(
'update_index'
,
start_date
=
second_start
.
isoformat
(),
end_date
=
second_end
.
isoformat
(),
verbosity
=
0
)
call_command
(
'update_index'
,
start_date
=
second_start
.
isoformat
(),
end_date
=
second_end
.
isoformat
(),
verbosity
=
0
)
results
=
self
.
_get_search_results
(
text
=
'note'
)
results
=
self
.
_get_search_results
(
text
=
'note'
)
self
.
assertEqual
(
results
[
'
count
'
],
1
)
self
.
assertEqual
(
results
[
'
total
'
],
1
)
self
.
assertEqual
(
results
[
'r
esult
s'
][
0
][
'text'
],
'Second note'
)
self
.
assertEqual
(
results
[
'r
ow
s'
][
0
][
'text'
],
'Second note'
)
# All notes.
# All notes.
call_command
(
'update_index'
,
start_date
=
start
.
isoformat
(),
end_date
=
end
.
isoformat
(),
verbosity
=
0
)
call_command
(
'update_index'
,
start_date
=
start
.
isoformat
(),
end_date
=
end
.
isoformat
(),
verbosity
=
0
)
results
=
self
.
_get_search_results
(
text
=
'note'
)
results
=
self
.
_get_search_results
(
text
=
'note'
)
self
.
assertEqual
(
results
[
'
count
'
],
3
)
self
.
assertEqual
(
results
[
'
total
'
],
3
)
@factory.django.mute_signals
(
signals
.
post_delete
)
@factory.django.mute_signals
(
signals
.
post_delete
)
def
test_delete
(
self
):
def
test_delete
(
self
):
...
@@ -55,7 +55,7 @@ class UpdateIndexTest(BaseAnnotationViewTests):
...
@@ -55,7 +55,7 @@ class UpdateIndexTest(BaseAnnotationViewTests):
self
.
_create_annotation
(
text
=
u'Third note'
)
self
.
_create_annotation
(
text
=
u'Third note'
)
results
=
self
.
_get_search_results
(
text
=
'note'
)
results
=
self
.
_get_search_results
(
text
=
'note'
)
self
.
assertEqual
(
results
[
'
count
'
],
3
)
self
.
assertEqual
(
results
[
'
total
'
],
3
)
# Delete first note.
# Delete first note.
url
=
reverse
(
'api:v1:annotations_detail'
,
kwargs
=
{
'annotation_id'
:
first_note
[
'id'
]})
url
=
reverse
(
'api:v1:annotations_detail'
,
kwargs
=
{
'annotation_id'
:
first_note
[
'id'
]})
...
@@ -75,5 +75,5 @@ class UpdateIndexTest(BaseAnnotationViewTests):
...
@@ -75,5 +75,5 @@ class UpdateIndexTest(BaseAnnotationViewTests):
results
=
self
.
_get_search_results
(
text
=
'note'
)
results
=
self
.
_get_search_results
(
text
=
'note'
)
# When remove flag is provided, start and end flags do not play any role.
# When remove flag is provided, start and end flags do not play any role.
self
.
assertEqual
(
results
[
'
count
'
],
1
)
self
.
assertEqual
(
results
[
'
total
'
],
1
)
self
.
assertEqual
(
results
[
'r
esult
s'
][
0
][
'text'
],
'Third note'
)
self
.
assertEqual
(
results
[
'r
ow
s'
][
0
][
'text'
],
'Third note'
)
notesapi/v1/tests/test_views.py
View file @
ea572112
This diff is collapsed.
Click to expand it.
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