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
ea0c9425
Commit
ea0c9425
authored
Dec 29, 2014
by
Oleg Marshev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test.
parent
f69981bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
notesapi/v1/tests/test_models.py
+8
-2
notesapi/v1/tests/test_views.py
+1
-1
No files found.
notesapi/v1/tests/test_models.py
View file @
ea0c9425
import
json
import
json
from
unittest
import
TestCase
from
unittest
import
TestCase
from
notesapi.v1.models
import
Note
from
notesapi.v1.models
import
Note
,
NoteMappingType
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
ValidationError
...
@@ -42,7 +42,7 @@ class NoteTest(TestCase):
...
@@ -42,7 +42,7 @@ class NoteTest(TestCase):
def
test_must_have_fields
(
self
):
def
test_must_have_fields
(
self
):
note
=
Note
()
note
=
Note
()
for
field
in
[
'user'
,
'usage_id'
,
'course_id'
]:
for
field
in
[
'user'
,
'usage_id'
,
'course_id'
,
'ranges'
]:
payload
=
self
.
note
.
copy
()
payload
=
self
.
note
.
copy
()
payload
.
pop
(
field
)
payload
.
pop
(
field
)
...
@@ -53,3 +53,9 @@ class NoteTest(TestCase):
...
@@ -53,3 +53,9 @@ class NoteTest(TestCase):
note
=
Note
()
note
=
Note
()
note
.
clean
(
self
.
note
)
note
.
clean
(
self
.
note
)
note
.
save
()
note
.
save
()
def
test_extract_document
(
self
):
note
=
Note
()
note
.
clean
(
self
.
note
)
note
.
save
()
self
.
assertEqual
(
NoteMappingType
.
extract_document
(
note
.
id
),
note
.
as_dict
())
notesapi/v1/tests/test_views.py
View file @
ea0c9425
...
@@ -332,7 +332,7 @@ class AnnotationViewTests(BaseAnnotationViewTests):
...
@@ -332,7 +332,7 @@ class AnnotationViewTests(BaseAnnotationViewTests):
Tests highlighting.
Tests highlighting.
"""
"""
self
.
_create_annotation
(
text
=
u'First note'
)
self
.
_create_annotation
(
text
=
u'First note'
)
note_2
=
self
.
_create_annotation
(
text
=
u'Second note'
)
self
.
_create_annotation
(
text
=
u'Second note'
)
results
=
self
.
_get_search_results
()
results
=
self
.
_get_search_results
()
self
.
assertEqual
(
results
[
'total'
],
2
)
self
.
assertEqual
(
results
[
'total'
],
2
)
...
...
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