Test fix
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 13 Nov 2012 14:06:49 +0000 (15:06 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 13 Nov 2012 14:06:49 +0000 (15:06 +0100)
apps/api/handlers.py
apps/catalogue/tests/tags.py

index be5993c..dbe905b 100644 (file)
@@ -138,7 +138,7 @@ class BookDetails(object):
     @classmethod
     def cover_thumb(cls, book):
         return MEDIA_BASE + default.backend.get_thumbnail(
-                    book.cover, "139x193").url
+                    book.cover, "139x193").url if book.cover else ''
 
 
 
index 3eab3da..2608eb6 100644 (file)
@@ -277,12 +277,11 @@ class BookTagsTests(WLTestCase):
         self.assertEqual([(tag.name, tag.count) for tag in related_themes],
                          [('ChildTheme', 1), ('ParentTheme', 1), ('Theme', 2)])
 
-    def test_main_page_tags(self):
+    def test_catalogue_tags(self):
         """ test main page tags and counts """
-        from catalogue.templatetags.catalogue_tags import catalogue_menu
-        menu = catalogue_menu()
-        self.assertEqual([(tag.name, tag.book_count) for tag in menu['author']],
+        context = self.client.get('/katalog/').context
+        self.assertEqual([(tag.name, tag.book_count) for tag in context['categories']['author']],
                          [('Jim Lazy', 1), ('Common Man', 1)])
-        self.assertEqual([(tag.name, tag.book_count) for tag in menu['theme']],
+        self.assertEqual([(tag.name, tag.book_count) for tag in context['categories']['theme']],
                          [('ChildTheme', 1), ('ParentTheme', 1), ('Theme', 2)])