Notes dictionary: language names.
[wolnelektury.git] / apps / dictionary / tests.py
index 0de7c5e..0c83cf1 100755 (executable)
@@ -5,7 +5,6 @@
 from django.core.files.base import ContentFile
 from catalogue.test_utils import *
 from catalogue.models import Book
 from django.core.files.base import ContentFile
 from catalogue.test_utils import *
 from catalogue.models import Book
-from dictionary.models import Note
 
 
 class DictionaryTests(WLTestCase):
 
 
 class DictionaryTests(WLTestCase):
@@ -13,19 +12,19 @@ class DictionaryTests(WLTestCase):
     def setUp(self):
         WLTestCase.setUp(self)
         self.book_info = BookInfoStub(
     def setUp(self):
         WLTestCase.setUp(self)
         self.book_info = BookInfoStub(
-            url=u"http://wolnelektury.pl/example/default-book",
-            about=u"http://wolnelektury.pl/example/URI/default_book",
-            title=u"Default Book",
             author=PersonStub(("Jim",), "Lazy"),
             kind="X-Kind",
             genre="X-Genre",
             epoch="X-Epoch",
             author=PersonStub(("Jim",), "Lazy"),
             kind="X-Kind",
             genre="X-Genre",
             epoch="X-Epoch",
+            **info_args(u"Default Book")
         )
 
     def test_book_with_footnote(self):
         BOOK_TEXT = """<utwor>
         <opowiadanie>
             <akap><pe><slowo_obce>rose</slowo_obce> --- kind of a flower.</pe></akap>
         )
 
     def test_book_with_footnote(self):
         BOOK_TEXT = """<utwor>
         <opowiadanie>
             <akap><pe><slowo_obce>rose</slowo_obce> --- kind of a flower.</pe></akap>
+            <akap><pe><slowo_obce>rose</slowo_obce> --- kind of a flower.</pe></akap>
+            <akap><pe><slowo_obce>rose</slowo_obce> (techn.) --- #FF007F.</pe></akap>
         </opowiadanie></utwor>
         """
 
         </opowiadanie></utwor>
         """
 
@@ -33,16 +32,21 @@ class DictionaryTests(WLTestCase):
 
         self.assertEqual(
             len(self.client.get('/przypisy/').context['object_list']),
 
         self.assertEqual(
             len(self.client.get('/przypisy/').context['object_list']),
-            1,
-            'There should be a note on the note list.')
+            2,
+            'There should be two notes on the note list.')
 
         self.assertEqual(
 
         self.assertEqual(
-            len(self.client.get('/przypisy/a/').context['object_list']),
+            len(self.client.get('/przypisy/?ltr=a').context['object_list']),
             0,
             'There should not be a note for the letter A.')
 
         self.assertEqual(
             0,
             'There should not be a note for the letter A.')
 
         self.assertEqual(
-            len(self.client.get('/przypisy/r/').context['object_list']),
+            len(self.client.get('/przypisy/?ltr=r').context['object_list']),
+            2,
+            'Both notes start with the letter R.')
+
+        self.assertEqual(
+            len(self.client.get('/przypisy/?qual=techn.').context['object_list']),
             1,
             1,
-            'There should be a note for the letter R.')
+            'There should be a note qualified with \'techn.\' qualifier.')