1 # -*- coding: utf-8 -*-
2 from catalogue import models
3 from catalogue.templatetags import catalogue_tags
4 from catalogue.test_utils import *
5 from django.core.files.base import ContentFile
8 class BookDescTests(WLTestCase):
9 """ tests book_title template tag """
12 WLTestCase.setUp(self)
13 authors = PersonStub(("Common",), "Man"), PersonStub(("Jane",), "Doe")
15 child_info = BookInfoStub(authors=authors, genre="Genre", epoch='Epoch', kind="Kind",
16 **info_args(u"Child"))
17 parent_info = BookInfoStub(authors=authors, genre="Genre", epoch='Epoch', kind="Kind",
18 parts=[child_info.url],
19 **info_args(u"Parent"))
21 self.child = models.Book.from_text_and_meta(ContentFile('<utwor/>'), child_info)
22 models.Book.from_text_and_meta(ContentFile('<utwor/>'), parent_info)
23 self.child = models.Book.objects.get(pk=self.child.pk)
25 def test_book_desc(self):
26 """ book description should return authors, ancestors, book """
27 self.assertEqual(catalogue_tags.book_title(self.child), 'Jane Doe, Common Man, Parent, Child')