def test_constructAuthorpermvoter(self):
     self.assertEqual(construct_authorpermvoter("A", "B", "C"), "@A/B|C")
     self.assertEqual(
         construct_authorpermvoter({
             'author': "A",
             'permlink': "B",
             'voter': 'C'
         }), "@A/B|C")
     self.assertEqual(
         construct_authorpermvoter({
             'authorperm': "A/B",
             'voter': 'C'
         }), "@A/B|C")
    def test_keyerror(self):
        bts = self.bts
        with self.assertRaises(exceptions.VoteDoesNotExistsException):
            Vote(construct_authorpermvoter(self.author, self.permlink,
                                           "asdfsldfjlasd"),
                 steem_instance=bts)

        with self.assertRaises(exceptions.VoteDoesNotExistsException):
            Vote(construct_authorpermvoter(self.author, "sdlfjd",
                                           "asdfsldfjlasd"),
                 steem_instance=bts)

        with self.assertRaises(exceptions.VoteDoesNotExistsException):
            Vote(construct_authorpermvoter("sdalfj", "dsfa", "asdfsldfjlasd"),
                 steem_instance=bts)
Example #3
0
    def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(hive=True), num_retries=10))
        cls.bts = Steem(
            node=nodelist.get_nodes(hive=True),
            nobroadcast=True,
            keys={"active": wif},
            num_retries=10
        )
        # from getpass import getpass
        # self.bts.wallet.unlock(getpass())
        set_shared_steem_instance(cls.bts)
        cls.bts.set_default_account("test")

        acc = Account("fullnodeupdate", steem_instance=cls.bts)
        n_votes = 0
        index = 0
        entries = acc.get_blog_entries(limit=30)[::-1]
        while n_votes == 0:
            comment = Comment(entries[index], steem_instance=cls.bts)
            votes = comment.get_votes()
            n_votes = len(votes)
            index += 1

        last_vote = votes[0]

        cls.authorpermvoter = construct_authorpermvoter(last_vote['author'], last_vote['permlink'], last_vote["voter"])
        [author, permlink, voter] = resolve_authorpermvoter(cls.authorpermvoter)
        cls.author = author
        cls.permlink = permlink
        cls.voter = voter
        cls.authorperm = construct_authorperm(author, permlink)
Example #4
0
    def test_keyerror(self, node_param):
        if node_param == "non_appbase":
            bts = self.bts
        else:
            bts = self.appbase
        with self.assertRaises(exceptions.VoteDoesNotExistsException):
            Vote(construct_authorpermvoter(self.author, self.permlink,
                                           "asdfsldfjlasd"),
                 steem_instance=bts)

        with self.assertRaises(exceptions.VoteDoesNotExistsException):
            Vote(construct_authorpermvoter(self.author, "sdlfjd",
                                           "asdfsldfjlasd"),
                 steem_instance=bts)

        with self.assertRaises(exceptions.VoteDoesNotExistsException):
            Vote(construct_authorpermvoter("sdalfj", "dsfa", "asdfsldfjlasd"),
                 steem_instance=bts)
Example #5
0
    def setUpClass(cls):
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
            normal=True, appbase=True),
                                                   num_retries=10))
        cls.bts = Steem(node=nodelist.get_nodes(),
                        nobroadcast=True,
                        keys={"active": wif},
                        num_retries=10)
        cls.testnet = Steem(node="https://testnet.steemitdev.com",
                            nobroadcast=True,
                            keys={"active": wif},
                            num_retries=10)
        # from getpass import getpass
        # self.bts.wallet.unlock(getpass())
        set_shared_steem_instance(cls.bts)
        cls.bts.set_default_account("test")

        acc = Account("holger80", steem_instance=cls.bts)
        n_votes = 0
        index = 0
        while n_votes == 0:
            comment = acc.get_feed(limit=30)[::-1][index]
            votes = comment.get_votes()
            n_votes = len(votes)
            index += 1

        last_vote = votes[0]

        cls.authorpermvoter = construct_authorpermvoter(
            last_vote['author'], last_vote['permlink'], last_vote["voter"])
        [author, permlink,
         voter] = resolve_authorpermvoter(cls.authorpermvoter)
        cls.author = author
        cls.permlink = permlink
        cls.voter = voter
        cls.authorperm = construct_authorperm(author, permlink)