def post_to_flow_board(self, page, post): """Post message as a Flow topic.""" board = Board(page) header, rest = post.split('\n', 1) title = header.strip('=') content = rest.lstrip() board.new_topic(title, content)
def test_create_topic(self): """Test creation of topic.""" content = 'If you can read this, the Flow code in Pywikibot works!' board = Board(self.site, 'Talk:Pywikibot test') topic = board.new_topic('Pywikibot test', content, 'wikitext') first_post = topic.replies()[0] wikitext = first_post.get(format='wikitext') self.assertIn('wikitext', first_post._content) self.assertNotIn('html', first_post._content) self.assertIsInstance(wikitext, unicode) self.assertEqual(wikitext, content)