Exemplo n.º 1
0
 def test_reply_to_locked_topic(self):
     """Test replying to locked topic (should raise exception)."""
     # Setup
     content = 'I am a reply to a locked topic. This is not good!'
     topic = Topic(self.site, 'Topic:Smxnipjfs8umm1wt')
     # Reply (should raise a LockedPageError exception)
     with self.assertRaises(LockedPageError):
         topic.reply(content, 'wikitext')
     topic_root = topic.root
     with self.assertRaises(LockedPageError):
         topic_root.reply(content, 'wikitext')
     topic_reply = topic.root.replies(force=True)[0]
     with self.assertRaises(LockedPageError):
         topic_reply.reply(content, 'wikitext')
Exemplo n.º 2
0
 def test_reply_to_topic(self):
     """Test replying to "topic" (really the topic's root post)."""
     # Setup
     content = 'I am a reply to the topic. Replying works!'
     topic = Topic(self.site, self._topic_title)
     old_replies = topic.replies(force=True)[:]
     # Reply
     reply_post = topic.reply(content, 'wikitext')
     # Test content
     wikitext = reply_post.get(format='wikitext')
     self.assertIn('wikitext', reply_post._content)
     self.assertNotIn('html', reply_post._content)
     self.assertIsInstance(wikitext, unicode)
     self.assertEqual(wikitext, content)
     # Test reply list in topic
     new_replies = topic.replies(force=True)
     self.assertEqual(len(new_replies), len(old_replies) + 1)
Exemplo n.º 3
0
 def test_reply_to_topic(self):
     """Test replying to "topic" (really the topic's root post)."""
     # Setup
     content = 'I am a reply to the topic. Replying works!'
     topic = Topic(self.site, self._topic_title)
     old_replies = topic.replies(force=True)[:]
     # Reply
     reply_post = topic.reply(content, 'wikitext')
     # Test content
     wikitext = reply_post.get(format='wikitext')
     self.assertIn('wikitext', reply_post._content)
     self.assertNotIn('html', reply_post._content)
     self.assertIsInstance(wikitext, unicode)
     self.assertEqual(wikitext, content)
     # Test reply list in topic
     new_replies = topic.replies(force=True)
     self.assertEqual(len(new_replies), len(old_replies) + 1)
Exemplo n.º 4
0
 def test_self_thank(self):
     """Test that thanking one's own Flow post causes an error."""
     site = self.get_site()
     topic = Topic(site, self._topic_title)
     my_reply = topic.reply('My attempt to thank myself.')
     self.assertAPIError('invalidrecipient', None, my_reply.thank)