|
@@ -186,7 +186,7 @@ class ThreadPostSplitApiTestCase(AuthenticatedUserTestCase):
|
|
}),
|
|
}),
|
|
content_type="application/json",
|
|
content_type="application/json",
|
|
)
|
|
)
|
|
- self.assertContains(response, "Events can't be split.", status_code=400)
|
|
|
|
|
|
+ self.assertContains(response, "Events can't be split.", status_code=403)
|
|
|
|
|
|
def test_split_first_post(self):
|
|
def test_split_first_post(self):
|
|
"""api rejects first post split"""
|
|
"""api rejects first post split"""
|
|
@@ -197,7 +197,7 @@ class ThreadPostSplitApiTestCase(AuthenticatedUserTestCase):
|
|
}),
|
|
}),
|
|
content_type="application/json",
|
|
content_type="application/json",
|
|
)
|
|
)
|
|
- self.assertContains(response, "You can't split thread's first post.", status_code=400)
|
|
|
|
|
|
+ self.assertContains(response, "You can't split thread's first post.", status_code=403)
|
|
|
|
|
|
def test_split_hidden_posts(self):
|
|
def test_split_hidden_posts(self):
|
|
"""api recjects attempt to split urneadable hidden post"""
|
|
"""api recjects attempt to split urneadable hidden post"""
|
|
@@ -209,7 +209,43 @@ class ThreadPostSplitApiTestCase(AuthenticatedUserTestCase):
|
|
content_type="application/json",
|
|
content_type="application/json",
|
|
)
|
|
)
|
|
self.assertContains(
|
|
self.assertContains(
|
|
- response, "You can't split posts the content you can't see.", status_code=400
|
|
|
|
|
|
+ response, "You can't split posts the content you can't see.", status_code=403
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ def test_split_posts_closed_thread_no_permission(self):
|
|
|
|
+ """api recjects attempt to split posts from closed thread"""
|
|
|
|
+ self.thread.is_closed = True
|
|
|
|
+ self.thread.save()
|
|
|
|
+
|
|
|
|
+ self.override_acl({'can_close_threads': 0})
|
|
|
|
+
|
|
|
|
+ response = self.client.post(
|
|
|
|
+ self.api_link,
|
|
|
|
+ json.dumps({
|
|
|
|
+ 'posts': [testutils.reply_thread(self.thread).pk],
|
|
|
|
+ }),
|
|
|
|
+ content_type="application/json",
|
|
|
|
+ )
|
|
|
|
+ self.assertContains(
|
|
|
|
+ response, "This thread is closed. You can't split posts in it.", status_code=403
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ def test_split_posts_closed_category_no_permission(self):
|
|
|
|
+ """api recjects attempt to split posts from closed thread"""
|
|
|
|
+ self.category.is_closed = True
|
|
|
|
+ self.category.save()
|
|
|
|
+
|
|
|
|
+ self.override_acl({'can_close_threads': 0})
|
|
|
|
+
|
|
|
|
+ response = self.client.post(
|
|
|
|
+ self.api_link,
|
|
|
|
+ json.dumps({
|
|
|
|
+ 'posts': [testutils.reply_thread(self.thread).pk],
|
|
|
|
+ }),
|
|
|
|
+ content_type="application/json",
|
|
|
|
+ )
|
|
|
|
+ self.assertContains(
|
|
|
|
+ response, "This category is closed. You can't split posts in it.", status_code=403
|
|
)
|
|
)
|
|
|
|
|
|
def test_split_other_thread_posts(self):
|
|
def test_split_other_thread_posts(self):
|