def test_vote(self): bts = self.bts vote = Vote(self.authorpermvoter, hive_instance=bts) self.assertEqual(self.voter, vote["voter"]) self.assertEqual(self.author, vote["author"]) self.assertEqual(self.permlink, vote["permlink"]) vote = Vote(self.voter, authorperm=self.authorperm, hive_instance=bts) self.assertEqual(self.voter, vote["voter"]) self.assertEqual(self.author, vote["author"]) self.assertEqual(self.permlink, vote["permlink"]) vote_json = vote.json() self.assertEqual(self.voter, vote_json["voter"]) self.assertEqual(self.voter, vote.voter) self.assertTrue(vote.weight >= 0) self.assertTrue(vote.hbd >= 0) self.assertTrue(vote.rshares >= 0) self.assertTrue(vote.percent >= 0) self.assertTrue(vote.reputation is not None) self.assertTrue(vote.rep is not None) self.assertTrue(vote.time is not None) vote.refresh() self.assertEqual(self.voter, vote["voter"]) self.assertEqual(self.author, vote["author"]) self.assertEqual(self.permlink, vote["permlink"]) vote_json = vote.json() self.assertEqual(self.voter, vote_json["voter"]) self.assertEqual(self.voter, vote.voter) self.assertTrue(vote.weight >= 0) self.assertTrue(vote.hbd >= 0) self.assertTrue(vote.rshares >= 0) self.assertTrue(vote.percent >= 0) self.assertTrue(vote.reputation is not None) self.assertTrue(vote.rep is not None) self.assertTrue(vote.time is not None)
def update_in_vote(self, timestamp, weight, op): v = Vote(op) try: v.refresh() self.in_vote_timestamp.append(timestamp) self.in_vote_weight.append(weight) self.in_vote_rep.append(int(v["reputation"])) self.in_vote_rshares.append(int(v["rshares"])) except: print("Could not found: %s" % v) return