New version of black, new whitespace
This commit is contained in:
@ -18,10 +18,10 @@ from bookwyrm.activitypub import ActivitypubResponse
|
||||
|
||||
|
||||
class BookViews(TestCase):
|
||||
""" books books books """
|
||||
"""books books books"""
|
||||
|
||||
def setUp(self):
|
||||
""" we need basic test data and mocks """
|
||||
"""we need basic test data and mocks"""
|
||||
self.factory = RequestFactory()
|
||||
self.local_user = models.User.objects.create_user(
|
||||
"mouse@local.com",
|
||||
@ -81,7 +81,7 @@ class BookViews(TestCase):
|
||||
)
|
||||
|
||||
def test_book_page(self):
|
||||
""" there are so many views, this just makes sure it LOADS """
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Book.as_view()
|
||||
request = self.factory.get("")
|
||||
request.user = self.local_user
|
||||
@ -100,7 +100,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_edit_book_page(self):
|
||||
""" there are so many views, this just makes sure it LOADS """
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.EditBook.as_view()
|
||||
request = self.factory.get("")
|
||||
request.user = self.local_user
|
||||
@ -111,7 +111,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_edit_book(self):
|
||||
""" lets a user edit a book """
|
||||
"""lets a user edit a book"""
|
||||
view = views.EditBook.as_view()
|
||||
self.local_user.groups.add(self.group)
|
||||
form = forms.EditionForm(instance=self.book)
|
||||
@ -125,7 +125,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(self.book.title, "New Title")
|
||||
|
||||
def test_edit_book_add_author(self):
|
||||
""" lets a user edit a book with new authors """
|
||||
"""lets a user edit a book with new authors"""
|
||||
view = views.EditBook.as_view()
|
||||
self.local_user.groups.add(self.group)
|
||||
form = forms.EditionForm(instance=self.book)
|
||||
@ -143,7 +143,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(self.book.title, "Example Edition")
|
||||
|
||||
def test_edit_book_add_new_author_confirm(self):
|
||||
""" lets a user edit a book confirmed with new authors """
|
||||
"""lets a user edit a book confirmed with new authors"""
|
||||
view = views.ConfirmEditBook.as_view()
|
||||
self.local_user.groups.add(self.group)
|
||||
form = forms.EditionForm(instance=self.book)
|
||||
@ -162,7 +162,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(self.book.authors.first().name, "Sappho")
|
||||
|
||||
def test_edit_book_remove_author(self):
|
||||
""" remove an author from a book """
|
||||
"""remove an author from a book"""
|
||||
author = models.Author.objects.create(name="Sappho")
|
||||
self.book.authors.add(author)
|
||||
form = forms.EditionForm(instance=self.book)
|
||||
@ -182,7 +182,7 @@ class BookViews(TestCase):
|
||||
self.assertFalse(self.book.authors.exists())
|
||||
|
||||
def test_create_book(self):
|
||||
""" create an entirely new book and work """
|
||||
"""create an entirely new book and work"""
|
||||
view = views.ConfirmEditBook.as_view()
|
||||
self.local_user.groups.add(self.group)
|
||||
form = forms.EditionForm()
|
||||
@ -196,7 +196,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(book.parent_work.title, "New Title")
|
||||
|
||||
def test_create_book_existing_work(self):
|
||||
""" create an entirely new book and work """
|
||||
"""create an entirely new book and work"""
|
||||
view = views.ConfirmEditBook.as_view()
|
||||
self.local_user.groups.add(self.group)
|
||||
form = forms.EditionForm()
|
||||
@ -211,7 +211,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(book.parent_work, self.work)
|
||||
|
||||
def test_create_book_with_author(self):
|
||||
""" create an entirely new book and work """
|
||||
"""create an entirely new book and work"""
|
||||
view = views.ConfirmEditBook.as_view()
|
||||
self.local_user.groups.add(self.group)
|
||||
form = forms.EditionForm()
|
||||
@ -229,7 +229,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(book.authors.first(), book.parent_work.authors.first())
|
||||
|
||||
def test_switch_edition(self):
|
||||
""" updates user's relationships to a book """
|
||||
"""updates user's relationships to a book"""
|
||||
work = models.Work.objects.create(title="test work")
|
||||
edition1 = models.Edition.objects.create(title="first ed", parent_work=work)
|
||||
edition2 = models.Edition.objects.create(title="second ed", parent_work=work)
|
||||
@ -253,7 +253,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(models.ReadThrough.objects.get().book, edition2)
|
||||
|
||||
def test_editions_page(self):
|
||||
""" there are so many views, this just makes sure it LOADS """
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Editions.as_view()
|
||||
request = self.factory.get("")
|
||||
with patch("bookwyrm.views.books.is_api_request") as is_api:
|
||||
@ -271,7 +271,7 @@ class BookViews(TestCase):
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_upload_cover_file(self):
|
||||
""" add a cover via file upload """
|
||||
"""add a cover via file upload"""
|
||||
self.assertFalse(self.book.cover)
|
||||
image_file = pathlib.Path(__file__).parent.joinpath(
|
||||
"../../static/images/default_avi.jpg"
|
||||
@ -296,7 +296,7 @@ class BookViews(TestCase):
|
||||
|
||||
@responses.activate
|
||||
def test_upload_cover_url(self):
|
||||
""" add a cover via url """
|
||||
"""add a cover via url"""
|
||||
self.assertFalse(self.book.cover)
|
||||
image_file = pathlib.Path(__file__).parent.joinpath(
|
||||
"../../static/images/default_avi.jpg"
|
||||
|
Reference in New Issue
Block a user