X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6d42bc478e3d1bd90eb294464748c21e4de0fc63..HEAD:/src/catalogue/tests/test_book_import.py diff --git a/src/catalogue/tests/test_book_import.py b/src/catalogue/tests/test_book_import.py index d3699249a..f38aea8c3 100644 --- a/src/catalogue/tests/test_book_import.py +++ b/src/catalogue/tests/test_book_import.py @@ -1,5 +1,5 @@ -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # from django.core.files.base import ContentFile from catalogue.test_utils import * @@ -14,7 +14,7 @@ class BookImportLogicTests(WLTestCase): def setUp(self): WLTestCase.setUp(self) self.book_info = BookInfoStub( - url=WLURI.from_slug("default-book"), + url=WLURI("default-book"), about="http://wolnelektury.pl/example/URI/default_book", title="Default Book", author=PersonStub(("Jim",), "Lazy"), @@ -25,10 +25,10 @@ class BookImportLogicTests(WLTestCase): ) self.expected_tags = [ - ('author', 'jim-lazy'), - ('genre', 'x-genre'), - ('epoch', 'x-epoch'), - ('kind', 'x-kind'), + ('author', 'jim-lazy'), + ('genre', 'x-genre'), + ('epoch', 'x-epoch'), + ('kind', 'x-kind'), ] self.expected_tags.sort() @@ -39,7 +39,7 @@ class BookImportLogicTests(WLTestCase): self.assertEqual(book.title, "Default Book") self.assertEqual(book.slug, "default-book") - self.assert_(book.parent is None) + self.assertTrue(book.parent is None) self.assertFalse(book.has_html_file()) # no fragments generated @@ -85,7 +85,7 @@ class BookImportLogicTests(WLTestCase): self.assertEqual(book.fragments.count(), 1) self.assertEqual(book.fragments.all()[0].text, '
Ala ma kota
\n') - self.assert_(('theme', 'love') in [(tag.category, tag.slug) for tag in book.fragments.all()[0].tags]) + self.assertTrue(('theme', 'love') in [(tag.category, tag.slug) for tag in book.fragments.all()[0].tags]) def test_book_with_empty_theme(self): """ empty themes should be ignored """ @@ -97,8 +97,14 @@ class BookImportLogicTests(WLTestCase): """ book = models.Book.from_text_and_meta(ContentFile(book_text), self.book_info) - self.assert_([('theme', 'love')], - book.fragments.all()[0].tags.filter(category='theme').values_list('category', 'slug')) + self.assertEqual( + [('theme', 'love')], + list( + book.fragments.all()[0].tags.filter( + category='theme' + ).values_list('category', 'slug') + ) + ) def test_book_with_no_theme(self): """ fragments with no themes shouldn't be created at all """ @@ -115,7 +121,7 @@ class BookImportLogicTests(WLTestCase): def test_book_with_invalid_slug(self): """ Book with invalid characters in slug shouldn't be imported """ - self.book_info.url = WLURI.from_slug("default_book") + self.book_info.url = WLURI("default_book") book_text = "