Browse Source

Format code with black

rafalp 6 years ago
parent
commit
1dfadd24ed

+ 1 - 3
misago/threads/tests/test_search.py

@@ -82,9 +82,7 @@ class SearchApiTests(AuthenticatedUserTestCase):
     def test_hidden_post(self):
         """hidden posts are extempt from search"""
         thread = test.post_thread(self.category)
-        post = test.reply_thread(
-            thread, message="Lorem ipsum dolor.", is_hidden=True
-        )
+        post = test.reply_thread(thread, message="Lorem ipsum dolor.", is_hidden=True)
         self.index_post(post)
 
         response = self.client.get("%s?q=ipsum" % self.api_link)

+ 1 - 3
misago/threads/tests/test_thread_postdelete_api.py

@@ -182,9 +182,7 @@ class EventDeleteApiTests(ThreadsApiTestCase):
     def setUp(self):
         super().setUp()
 
-        self.event = test.reply_thread(
-            self.thread, poster=self.user, is_event=True
-        )
+        self.event = test.reply_thread(self.thread, poster=self.user, is_event=True)
 
         self.api_link = reverse(
             "misago:api:thread-post-detail",

+ 3 - 9
misago/threads/tests/test_thread_postmerge_api.py

@@ -421,9 +421,7 @@ class ThreadPostMergeApiTestCase(AuthenticatedUserTestCase):
     @patch_category_acl({"can_merge_posts": True})
     def test_merge_posts(self):
         """api merges two posts"""
-        post_a = test.reply_thread(
-            self.thread, poster=self.user, message="Battęry"
-        )
+        post_a = test.reply_thread(self.thread, poster=self.user, message="Battęry")
         post_b = test.reply_thread(self.thread, poster=self.user, message="Hórse")
 
         thread_replies = self.thread.replies
@@ -510,9 +508,7 @@ class ThreadPostMergeApiTestCase(AuthenticatedUserTestCase):
         self.thread.first_post.poster = self.user
         self.thread.first_post.save()
 
-        post_visible = test.reply_thread(
-            self.thread, poster=self.user, is_hidden=False
-        )
+        post_visible = test.reply_thread(self.thread, poster=self.user, is_hidden=False)
 
         response = self.client.post(
             self.api_link,
@@ -623,9 +619,7 @@ class ThreadPostMergeApiTestCase(AuthenticatedUserTestCase):
     @patch_category_acl({"can_merge_posts": True})
     def test_merge_remove_reads(self):
         """two posts merge removes read tracker from post"""
-        post_a = test.reply_thread(
-            self.thread, poster=self.user, message="Battęry"
-        )
+        post_a = test.reply_thread(self.thread, poster=self.user, message="Battęry")
         post_b = test.reply_thread(self.thread, poster=self.user, message="Hórse")
 
         poststracker.save_read(self.user, post_a)

+ 2 - 7
misago/threads/tests/test_thread_postmove_api.py

@@ -300,9 +300,7 @@ class ThreadPostMoveApiTestCase(AuthenticatedUserTestCase):
             json.dumps(
                 {
                     "new_thread": other_thread.get_absolute_url(),
-                    "posts": [
-                        test.reply_thread(self.thread, is_unapproved=True).pk
-                    ],
+                    "posts": [test.reply_thread(self.thread, is_unapproved=True).pk],
                 }
             ),
             content_type="application/json",
@@ -513,10 +511,7 @@ class ThreadPostMoveApiTestCase(AuthenticatedUserTestCase):
         """api moves posts reads together with posts"""
         other_thread = test.post_thread(self.other_category)
 
-        posts = (
-            test.reply_thread(self.thread),
-            test.reply_thread(self.thread),
-        )
+        posts = (test.reply_thread(self.thread), test.reply_thread(self.thread))
 
         self.thread.refresh_from_db()
         self.assertEqual(self.thread.replies, 2)

+ 1 - 3
misago/threads/tests/test_thread_postpatch_api.py

@@ -845,9 +845,7 @@ class ThreadEventPatchApiTestCase(ThreadPostPatchApiTestCase):
     def setUp(self):
         super().setUp()
 
-        self.event = test.reply_thread(
-            self.thread, poster=self.user, is_event=True
-        )
+        self.event = test.reply_thread(self.thread, poster=self.user, is_event=True)
 
         self.api_link = reverse(
             "misago:api:thread-post-detail",

+ 3 - 9
misago/threads/tests/test_thread_postsplit_api.py

@@ -195,9 +195,7 @@ class ThreadPostSplitApiTestCase(AuthenticatedUserTestCase):
         """api rejects events split"""
         response = self.client.post(
             self.api_link,
-            json.dumps(
-                {"posts": [test.reply_thread(self.thread, is_event=True).pk]}
-            ),
+            json.dumps({"posts": [test.reply_thread(self.thread, is_event=True).pk]}),
             content_type="application/json",
         )
         self.assertEqual(response.status_code, 400)
@@ -221,9 +219,7 @@ class ThreadPostSplitApiTestCase(AuthenticatedUserTestCase):
         """api recjects attempt to split urneadable hidden post"""
         response = self.client.post(
             self.api_link,
-            json.dumps(
-                {"posts": [test.reply_thread(self.thread, is_hidden=True).pk]}
-            ),
+            json.dumps({"posts": [test.reply_thread(self.thread, is_hidden=True).pk]}),
             content_type="application/json",
         )
         self.assertEqual(response.status_code, 400)
@@ -273,9 +269,7 @@ class ThreadPostSplitApiTestCase(AuthenticatedUserTestCase):
 
         response = self.client.post(
             self.api_link,
-            json.dumps(
-                {"posts": [test.reply_thread(other_thread, is_hidden=True).pk]}
-            ),
+            json.dumps({"posts": [test.reply_thread(other_thread, is_hidden=True).pk]}),
             content_type="application/json",
         )
         self.assertEqual(response.status_code, 400)

+ 6 - 18
misago/threads/tests/test_threadslists.py

@@ -583,9 +583,7 @@ class ThreadsVisibilityTests(ThreadsListTestCase):
     @patch_categories_acl()
     def test_list_user_cant_see_unapproved_thread(self):
         """list hides unapproved thread that belongs to other user"""
-        test_thread = test.post_thread(
-            category=self.category_a, is_unapproved=True
-        )
+        test_thread = test.post_thread(category=self.category_a, is_unapproved=True)
 
         response = self.client.get("/")
         self.assertEqual(response.status_code, 200)
@@ -669,9 +667,7 @@ class ThreadsVisibilityTests(ThreadsListTestCase):
     @patch_categories_acl({"can_approve_content": 1})
     def test_list_user_can_see_unapproved_thread(self):
         """list shows hidden thread that belongs to other user due to permission"""
-        test_thread = test.post_thread(
-            category=self.category_a, is_unapproved=True
-        )
+        test_thread = test.post_thread(category=self.category_a, is_unapproved=True)
 
         response = self.client.get("/")
         self.assertEqual(response.status_code, 200)
@@ -1246,13 +1242,9 @@ class UnapprovedListTests(ThreadsListTestCase):
     )
     def test_list_shows_all_threads_for_approving_user(self):
         """list shows all threads with unapproved posts when user has perm"""
-        visible_thread = test.post_thread(
-            category=self.category_b, is_unapproved=True
-        )
+        visible_thread = test.post_thread(category=self.category_b, is_unapproved=True)
 
-        hidden_thread = test.post_thread(
-            category=self.category_b, is_unapproved=False
-        )
+        hidden_thread = test.post_thread(category=self.category_b, is_unapproved=False)
 
         response = self.client.get("/unapproved/")
         self.assertEqual(response.status_code, 200)
@@ -1277,9 +1269,7 @@ class UnapprovedListTests(ThreadsListTestCase):
             poster=self.user, category=self.category_b, is_unapproved=True
         )
 
-        hidden_thread = test.post_thread(
-            category=self.category_b, is_unapproved=True
-        )
+        hidden_thread = test.post_thread(category=self.category_b, is_unapproved=True)
 
         response = self.client.get("/unapproved/")
         self.assertEqual(response.status_code, 200)
@@ -1320,9 +1310,7 @@ class OwnerOnlyThreadsVisibilityTests(AuthenticatedUserTestCase):
             poster=self.user, category=self.category, is_unapproved=True
         )
 
-        hidden_thread = test.post_thread(
-            category=self.category, is_unapproved=True
-        )
+        hidden_thread = test.post_thread(category=self.category, is_unapproved=True)
 
         with patch_category_see_all_threads_acl():
             response = self.client.get(self.category.get_absolute_url())

+ 1 - 1
misago/users/tests/test_activation_views.py

@@ -24,7 +24,7 @@ class ActivationViewsTests(TestCase):
         Ban.objects.create(
             check_type=Ban.USERNAME, banned_value="user", user_message="Nope!"
         )
-        
+
         response = self.client.get(
             reverse(
                 "misago:activate-by-token",

+ 1 - 5
misago/users/tests/test_testutils.py

@@ -1,10 +1,6 @@
 from django.urls import reverse
 
-from misago.users.test import (
-    AuthenticatedUserTestCase,
-    SuperUserTestCase,
-    UserTestCase,
-)
+from misago.users.test import AuthenticatedUserTestCase, SuperUserTestCase, UserTestCase
 
 
 class UserTestCaseTests(UserTestCase):