New version of black, new whitespace

This commit is contained in:
Mouse Reeve
2021-04-26 09:15:42 -07:00
parent ef83eb33b0
commit 3ade2d3bb1
152 changed files with 1289 additions and 1289 deletions

View File

@ -13,10 +13,10 @@ from bookwyrm.settings import USER_AGENT
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
class ViewsHelpers(TestCase):
""" viewing and creating statuses """
"""viewing and creating statuses"""
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",
@ -53,12 +53,12 @@ class ViewsHelpers(TestCase):
)
def test_get_edition(self, _):
""" given an edition or a work, returns an edition """
"""given an edition or a work, returns an edition"""
self.assertEqual(views.helpers.get_edition(self.book.id), self.book)
self.assertEqual(views.helpers.get_edition(self.work.id), self.book)
def test_get_user_from_username(self, _):
""" works for either localname or username """
"""works for either localname or username"""
self.assertEqual(
views.helpers.get_user_from_username(self.local_user, "mouse"),
self.local_user,
@ -71,7 +71,7 @@ class ViewsHelpers(TestCase):
views.helpers.get_user_from_username(self.local_user, "mojfse@example.com")
def test_is_api_request(self, _):
""" should it return html or json """
"""should it return html or json"""
request = self.factory.get("/path")
request.headers = {"Accept": "application/json"}
self.assertTrue(views.helpers.is_api_request(request))
@ -85,12 +85,12 @@ class ViewsHelpers(TestCase):
self.assertFalse(views.helpers.is_api_request(request))
def test_is_api_request_no_headers(self, _):
""" should it return html or json """
"""should it return html or json"""
request = self.factory.get("/path")
self.assertFalse(views.helpers.is_api_request(request))
def test_is_bookwyrm_request(self, _):
""" checks if a request came from a bookwyrm instance """
"""checks if a request came from a bookwyrm instance"""
request = self.factory.get("", {"q": "Test Book"})
self.assertFalse(views.helpers.is_bookwyrm_request(request))
@ -105,7 +105,7 @@ class ViewsHelpers(TestCase):
self.assertTrue(views.helpers.is_bookwyrm_request(request))
def test_existing_user(self, _):
""" simple database lookup by username """
"""simple database lookup by username"""
result = views.helpers.handle_remote_webfinger("@mouse@local.com")
self.assertEqual(result, self.local_user)
@ -117,7 +117,7 @@ class ViewsHelpers(TestCase):
@responses.activate
def test_load_user(self, _):
""" find a remote user using webfinger """
"""find a remote user using webfinger"""
username = "mouse@example.com"
wellknown = {
"subject": "acct:mouse@example.com",
@ -147,7 +147,7 @@ class ViewsHelpers(TestCase):
self.assertEqual(result.username, "mouse@example.com")
def test_user_on_blocked_server(self, _):
""" find a remote user using webfinger """
"""find a remote user using webfinger"""
models.FederatedServer.objects.create(
server_name="example.com", status="blocked"
)
@ -156,7 +156,7 @@ class ViewsHelpers(TestCase):
self.assertIsNone(result)
def test_handle_reading_status_to_read(self, _):
""" posts shelve activities """
"""posts shelve activities"""
shelf = self.local_user.shelf_set.get(identifier="to-read")
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
views.helpers.handle_reading_status(
@ -168,7 +168,7 @@ class ViewsHelpers(TestCase):
self.assertEqual(status.content, "wants to read")
def test_handle_reading_status_reading(self, _):
""" posts shelve activities """
"""posts shelve activities"""
shelf = self.local_user.shelf_set.get(identifier="reading")
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
views.helpers.handle_reading_status(
@ -180,7 +180,7 @@ class ViewsHelpers(TestCase):
self.assertEqual(status.content, "started reading")
def test_handle_reading_status_read(self, _):
""" posts shelve activities """
"""posts shelve activities"""
shelf = self.local_user.shelf_set.get(identifier="read")
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
views.helpers.handle_reading_status(
@ -192,7 +192,7 @@ class ViewsHelpers(TestCase):
self.assertEqual(status.content, "finished reading")
def test_handle_reading_status_other(self, _):
""" posts shelve activities """
"""posts shelve activities"""
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
views.helpers.handle_reading_status(
self.local_user, self.shelf, self.book, "public"
@ -200,7 +200,7 @@ class ViewsHelpers(TestCase):
self.assertFalse(models.GeneratedNote.objects.exists())
def test_get_annotated_users(self, _):
""" list of people you might know """
"""list of people you might know"""
user_1 = models.User.objects.create_user(
"nutria@local.com",
"nutria@nutria.com",
@ -247,7 +247,7 @@ class ViewsHelpers(TestCase):
self.assertEqual(remote_user_annotated.shared_books, 0)
def test_get_annotated_users_counts(self, _):
""" correct counting for multiple shared attributed """
"""correct counting for multiple shared attributed"""
user_1 = models.User.objects.create_user(
"nutria@local.com",
"nutria@nutria.com",