1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
4 from django.core.files.base import ContentFile
5 from catalogue.test_utils import *
6 from catalogue.models import Book
9 class DictionaryTests(WLTestCase):
12 WLTestCase.setUp(self)
13 self.book_info = BookInfoStub(
14 author=PersonStub(("Jim",), "Lazy"),
18 **info_args("Default Book")
21 def test_book_with_footnote(self):
22 book_text = b"""<utwor>
24 <akap><pe><slowo_obce>rose</slowo_obce> --- kind of a flower.</pe></akap>
25 <akap><pe><slowo_obce>rose</slowo_obce> --- kind of a flower.</pe></akap>
26 <akap><pe><slowo_obce>rose</slowo_obce> (techn.) --- #FF007F.</pe></akap>
27 </opowiadanie></utwor>
30 book = Book.from_text_and_meta(ContentFile(book_text), self.book_info)
33 len(self.client.get('/przypisy/').context['object_list']),
35 'There should be two notes on the note list.')
38 len(self.client.get('/przypisy/?ltr=a').context['object_list']),
40 'There should not be a note for the letter A.')
43 len(self.client.get('/przypisy/?ltr=r').context['object_list']),
45 'Both notes start with the letter R.')
48 len(self.client.get('/przypisy/?qual=techn.').context['object_list']),
50 'There should be a note qualified with \'techn.\' qualifier.')