Browse Source

updated and expanded tests suite for threads moderation

Rafał Pitoń 10 years ago
parent
commit
a2e71490c2
1 changed files with 10 additions and 1 deletions
  1. 10 1
      misago/threads/tests/test_threads_moderation.py

+ 10 - 1
misago/threads/tests/test_threads_moderation.py

@@ -190,9 +190,14 @@ class ThreadsModerationTests(AuthenticatedUserTestCase):
         self.assertTrue(self.thread.has_events)
         event = self.thread.event_set.last()
 
-        self.assertIn("hid thread.", event.message)
+        self.assertIn("hidden thread.", event.message)
         self.assertEqual(event.icon, "eye-slash")
 
+    def test_hide_hidden_thread(self):
+        """hide_thread fails gracefully for hidden thread"""
+        self.thread.is_hidden = True
+        self.assertFalse(moderation.hide_thread(self.user, self.thread))
+
     def test_unhide_thread(self):
         """unhide_thread unhides thread"""
         moderation.hide_thread(self.user, self.thread)
@@ -209,6 +214,10 @@ class ThreadsModerationTests(AuthenticatedUserTestCase):
         self.assertIn("made thread visible.", event.message)
         self.assertEqual(event.icon, "eye")
 
+    def test_unhide_visible_thread(self):
+        """unhide_thread fails gracefully for visible thread"""
+        self.assertFalse(moderation.unhide_thread(self.user, self.thread))
+
     def test_delete_thread(self):
         """delete_thread deletes thread"""
         self.assertTrue(moderation.delete_thread(self.user, self.thread))