def test_comment_dict(self): bts = self.bts title = '' cnt = 0 while title == '' and cnt < 5: c = Comment({ 'author': self.author, 'permlink': self.permlink }, hive_instance=bts) c.refresh() title = c.title cnt += 1 if title == '': c.hive.rpc.next() c.refresh() title = c.title self.assertEqual(c.author, self.author) self.assertEqual(c.permlink, self.permlink) self.assertEqual(c.authorperm, self.authorperm) self.assertEqual(c.category, self.category) self.assertEqual(c.parent_author, '') self.assertEqual(c.parent_permlink, self.category) self.assertEqual(c.title, self.title)
def test_comment(self): bts = self.bts with self.assertRaises(exceptions.ContentDoesNotExistsException): Comment("@abcdef/abcdef", hive_instance=bts) title = '' cnt = 0 while title == '' and cnt < 5: c = Comment(self.authorperm, hive_instance=bts) title = c.title cnt += 1 if title == '': c.hive.rpc.next() c.refresh() title = c.title self.assertTrue(isinstance(c.id, int)) self.assertTrue(c.id > 0) self.assertEqual(c.author, self.author) self.assertEqual(c.permlink, self.permlink) self.assertEqual(c.authorperm, self.authorperm) self.assertEqual(c.category, self.category) self.assertEqual(c.parent_author, '') self.assertEqual(c.parent_permlink, self.category) self.assertEqual(c.title, self.title) self.assertTrue(len(c.body) > 0) self.assertTrue(isinstance(c.json_metadata, dict)) self.assertTrue(c.is_main_post()) self.assertFalse(c.is_comment()) if c.is_pending(): self.assertFalse( (c.time_elapsed().total_seconds() / 60 / 60 / 24) > 7.0) else: self.assertTrue( (c.time_elapsed().total_seconds() / 60 / 60 / 24) > 7.0) self.assertTrue(isinstance(c.get_reblogged_by(), list)) self.assertTrue(len(c.get_reblogged_by()) > 0) self.assertTrue(isinstance(c.get_votes(), list)) self.assertTrue(len(c.get_votes()) > 0) self.assertTrue(isinstance(c.get_votes()[0], Vote))