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
7 from django.contrib.auth.models import User
10 class DictionaryTests(WLTestCase):
13 WLTestCase.setUp(self)
14 self.book_info = BookInfoStub(
15 author=PersonStub(("Jim",), "Lazy"),
19 **info_args("Default Book")
21 self.user = User.objects.create(username='test')
22 self.user.set_password('test')
25 def test_book_with_footnote(self):
26 book_text = b"""<utwor>
28 <akap><pe><slowo_obce>rose</slowo_obce> --- kind of a flower.</pe></akap>
29 <akap><pe><slowo_obce>rose</slowo_obce> --- kind of a flower.</pe></akap>
30 <akap><pe><slowo_obce>rose</slowo_obce> (techn.) --- #FF007F.</pe></akap>
31 </opowiadanie></utwor>
34 book = Book.from_text_and_meta(ContentFile(book_text), self.book_info)
35 self.client.login(username='test', password='test')
38 len(self.client.get('/przypisy/').context['object_list']),
40 'There should be two notes on the note list.')
43 len(self.client.get('/przypisy/?ltr=a').context['object_list']),
45 'There should not be a note for the letter A.')
48 len(self.client.get('/przypisy/?ltr=r').context['object_list']),
50 'Both notes start with the letter R.')
53 len(self.client.get('/przypisy/?qual=techn.').context['object_list']),
55 'There should be a note qualified with \'techn.\' qualifier.')