Example #1
0
 def test_thank_post(self):
     """Test thanks for Flow posts."""
     site = self.get_site()
     topic = Topic(site, self._topic_title)
     for post in reversed(topic.replies()):
         user = post.creator
         if site.user() == user.username:
             continue
         if user.is_thankable:
             break
     else:
         self.skipTest(NO_THANKABLE_POSTS)
     before_time = site.getcurrenttimestamp()
     post.thank()
     log_entries = site.logevents(logtype='thanks',
                                  total=5,
                                  page=user,
                                  start=before_time,
                                  reverse=True)
     try:
         next(iter(log_entries))
     except StopIteration:
         found_log = False
     else:
         found_log = True
     self.assertTrue(found_log)
Example #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)
 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)
 def test_topic(self):
     """Test general functions of the Topic class."""
     topic = Topic(self.site, 'Topic:U5y4l1rzitlplyc5')
     self.assertEqual(topic.root.uuid, 'u5y4l1rzitlplyc5')
     replies = topic.replies()
     self.assertLength(replies, 4)
     self.assertTrue(all(isinstance(reply, Post) for reply in replies))
     self.assertEqual(replies[1].uuid, 'u5y5lysqcvyne4k1')