コード例 #1
0
ファイル: test_vote.py プロジェクト: oldas1/beem
    def test_vote(self):
        bts = self.bts
        vote = Vote(self.authorpermvoter, steem_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, steem_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.sbd >= 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.sbd >= 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)
コード例 #2
0
 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
コード例 #3
0
    def test_vote(self):
        bts = self.bts
        self.assertTrue(len(bts.get_reward_funds(use_stored_data=False)) > 0)
        vote = Vote(self.authorpermvoter, blockchain_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,
                    blockchain_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)
        if vote.percent >= 0:
            self.assertTrue(vote.hbd >= 0)
            self.assertTrue(vote.rshares >= 0)
        else:
            self.assertTrue(vote.hbd < 0)
            self.assertTrue(vote.rshares < 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)
        if vote.percent >= 0:
            self.assertTrue(vote.hbd >= 0)
            self.assertTrue(vote.rshares >= 0)
        else:
            self.assertTrue(vote.hbd < 0)
            self.assertTrue(vote.rshares < 0)
        self.assertTrue(vote.reputation is not None)
        self.assertTrue(vote.rep is not None)
        self.assertTrue(vote.time is not None)