Exemplo n.º 1
0
 def test_disallow(self):
     bts = self.bts
     acc = Account("dpaycli", dpay_instance=bts)
     if sys.version > '3':
         _assertRaisesRegex = self.assertRaisesRegex
     else:
         _assertRaisesRegex = self.assertRaisesRegexp
     with _assertRaisesRegex(ValueError, ".*Changes nothing.*"):
         acc.disallow(
             "STX55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n",
             weight=1,
             threshold=1,
             permission="active"
         )
     with _assertRaisesRegex(ValueError, ".*Changes nothing!.*"):
         acc.disallow(
             "STX6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
             weight=1,
             threshold=1,
             permission="active"
         )
Exemplo n.º 2
0
    memo_privkey = memo_key.get_private_key()
    if useWallet:
        stm.wallet.addPrivateKey(owner_privkey)
        stm.wallet.addPrivateKey(active_privkey)
        stm.wallet.addPrivateKey(memo_privkey)
        stm.wallet.addPrivateKey(posting_privkey)
    else:
        stm = DPay(node=testnet_node,
                   wif={
                       'active': str(active_privkey),
                       'posting': str(posting_privkey),
                       'memo': str(memo_privkey)
                   })
    account = Account(username, dpay_instance=stm)
    if account["name"] == "dpaycli":
        account.disallow("dpaycli1", permission='posting')
        account.allow('dpaycli1', weight=1, permission='posting', account=None)
        account.follow("dpaycli1")
    elif account["name"] == "dpaycli5":
        account.allow('dpaycli4', weight=2, permission='active', account=None)
    if useWallet:
        stm.wallet.getAccountFromPrivateKey(str(active_privkey))

    # stm.create_account("dpaycli1", creator=account, password=password1)

    account1 = Account("dpaycli1", dpay_instance=stm)
    b = Blockchain(dpay_instance=stm)
    blocknum = b.get_current_block().identifier

    account.transfer("dpaycli1", 1, "BBD", "test")
    b1 = Block(blocknum, dpay_instance=stm)