Commit ea0c9425 by Oleg Marshev

Add test.

parent f69981bf
import json
from unittest import TestCase
from notesapi.v1.models import Note
from notesapi.v1.models import Note, NoteMappingType
from django.core.exceptions import ValidationError
......@@ -42,7 +42,7 @@ class NoteTest(TestCase):
def test_must_have_fields(self):
note = Note()
for field in ['user', 'usage_id', 'course_id']:
for field in ['user', 'usage_id', 'course_id', 'ranges']:
payload = self.note.copy()
payload.pop(field)
......@@ -53,3 +53,9 @@ class NoteTest(TestCase):
note = Note()
note.clean(self.note)
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())
......@@ -332,7 +332,7 @@ class AnnotationViewTests(BaseAnnotationViewTests):
Tests highlighting.
"""
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()
self.assertEqual(results['total'], 2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment