Skip to content
Snippets Groups Projects
Commit 27e41802 authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

add more unit tests for account

Release of next version 0.19.5 prepared
parent acbb3975
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,8 @@ The library name is derived from a beam maschine, similar to the analogy between ...@@ -27,6 +27,8 @@ The library name is derived from a beam maschine, similar to the analogy between
Installation Installation
============ ============
The minimal working python version 3.4.x.
Warning: install beem will install pycrytodome which is not compatible to pycryto which is need for python-steem. Warning: install beem will install pycrytodome which is not compatible to pycryto which is need for python-steem.
At the moment, either beem or steem can be install at one maschine! At the moment, either beem or steem can be install at one maschine!
...@@ -77,9 +79,15 @@ Documentation is available at http://beem.readthedocs.io/en/latest/ ...@@ -77,9 +79,15 @@ Documentation is available at http://beem.readthedocs.io/en/latest/
Changelog Changelog
========= =========
0.19.5
------
* Market fixed
* Account, Comment, Discussion and Witness class improved
* Bug fixes
0.19.4 0.19.4
------ ------
* beem * New library name is now beem
* Upstream fixes from https://github.com/xeroc/python-bitshares * Upstream fixes from https://github.com/xeroc/python-bitshares
* Improved Docu * Improved Docu
......
...@@ -714,7 +714,7 @@ class Account(BlockchainObject): ...@@ -714,7 +714,7 @@ class Account(BlockchainObject):
}) })
return self.steem.finalizeOp(op, account, "active") return self.steem.finalizeOp(op, account, "active")
def transfer_from_savings_cancel(self, request_id, account=None): def cancel_transfer_from_savings(self, request_id, account=None):
""" Cancel a withdrawal from 'savings' account. """ Cancel a withdrawal from 'savings' account.
:param str request_id: Identifier for tracking or cancelling :param str request_id: Identifier for tracking or cancelling
the withdrawal the withdrawal
...@@ -844,7 +844,7 @@ class Account(BlockchainObject): ...@@ -844,7 +844,7 @@ class Account(BlockchainObject):
else: else:
amount = Amount(amount, "VESTS", steem_instance=self.steem) amount = Amount(amount, "VESTS", steem_instance=self.steem)
assert amount["symbol"] == "VESTS" assert amount["symbol"] == "VESTS"
op = operations.WithdrawVesting( op = operations.Withdraw_vesting(
**{ **{
"account": account["name"], "account": account["name"],
"vesting_shares": amount, "vesting_shares": amount,
......
# THIS FILE IS GENERATED FROM beem SETUP.PY # THIS FILE IS GENERATED FROM beem SETUP.PY
version = '0.19.4' version = '0.19.5'
# THIS FILE IS GENERATED FROM beem SETUP.PY # THIS FILE IS GENERATED FROM beem SETUP.PY
version = '0.19.4' version = '0.19.5'
# THIS FILE IS GENERATED FROM beem SETUP.PY # THIS FILE IS GENERATED FROM beem SETUP.PY
version = '0.19.4' version = '0.19.5'
...@@ -83,6 +83,16 @@ Quickstart ...@@ -83,6 +83,16 @@ Quickstart
for h in account.history(): for h in account.history():
print(h) print(h)
.. code-block:: python
from beem.steem import Steem
stm = Steem()
stm.wallet.purge()
stm.wallet.create("wallet-passphrase")
stm.wallet.unlock("wallet-passphrase")
stm.wallet.addPrivateKey("512345678")
stm.wallet.lock()
.. code-block:: python .. code-block:: python
from beem.market import Market from beem.market import Market
......
...@@ -22,8 +22,7 @@ class Testcases(unittest.TestCase): ...@@ -22,8 +22,7 @@ class Testcases(unittest.TestCase):
self.bts = Steem( self.bts = Steem(
nodes, nodes,
nobroadcast=True, nobroadcast=True,
# We want to bundle many operations into a single transaction bundle=False,
bundle=True,
# Overwrite wallet to use this list of wifs only # Overwrite wallet to use this list of wifs only
wif={"active": wif} wif={"active": wif}
) )
...@@ -56,3 +55,107 @@ class Testcases(unittest.TestCase): ...@@ -56,3 +55,107 @@ class Testcases(unittest.TestCase):
# self.assertEqual(account["id"], "1.2.1") # self.assertEqual(account["id"], "1.2.1")
self.assertEqual(str(account), "<Account test>") self.assertEqual(str(account), "<Account test>")
self.assertIsInstance(Account(account), Account) self.assertIsInstance(Account(account), Account)
def test_withdraw_vesting(self):
bts = self.bts
w = Account("test", steem_instance=bts)
tx = w.withdraw_vesting("100 VESTS")
self.assertEqual(
(tx["operations"][0][0]),
"withdraw_vesting"
)
op = tx["operations"][0][1]
self.assertIn(
"test",
op["account"])
def test_delegate_vesting_shares(self):
bts = self.bts
w = Account("test", steem_instance=bts)
tx = w.delegate_vesting_shares("test1", "100 VESTS")
self.assertEqual(
(tx["operations"][0][0]),
"delegate_vesting_shares"
)
op = tx["operations"][0][1]
self.assertIn(
"test",
op["delegator"])
def test_claim_reward_balance(self):
bts = self.bts
w = Account("test", steem_instance=bts)
tx = w.claim_reward_balance()
self.assertEqual(
(tx["operations"][0][0]),
"claim_reward_balance"
)
op = tx["operations"][0][1]
self.assertIn(
"test",
op["account"])
def test_cancel_transfer_from_savings(self):
bts = self.bts
w = Account("test", steem_instance=bts)
tx = w.cancel_transfer_from_savings(0)
self.assertEqual(
(tx["operations"][0][0]),
"cancel_transfer_from_savings"
)
op = tx["operations"][0][1]
self.assertIn(
"test",
op["from"])
def test_transfer_from_savings(self):
bts = self.bts
w = Account("test", steem_instance=bts)
tx = w.transfer_from_savings(1, "STEEM", "")
self.assertEqual(
(tx["operations"][0][0]),
"transfer_from_savings"
)
op = tx["operations"][0][1]
self.assertIn(
"test",
op["from"])
def test_transfer_to_savings(self):
bts = self.bts
w = Account("test", steem_instance=bts)
tx = w.transfer_to_savings(1, "STEEM", "")
self.assertEqual(
(tx["operations"][0][0]),
"transfer_to_savings"
)
op = tx["operations"][0][1]
self.assertIn(
"test",
op["from"])
def test_convert(self):
bts = self.bts
w = Account("test", steem_instance=bts)
tx = w.convert("1 SBD")
self.assertEqual(
(tx["operations"][0][0]),
"convert"
)
op = tx["operations"][0][1]
self.assertIn(
"test",
op["owner"])
def test_transfer_to_vesting(self):
bts = self.bts
w = Account("test", steem_instance=bts)
tx = w.transfer_to_vesting("1 STEEM")
self.assertEqual(
(tx["operations"][0][0]),
"transfer_to_vesting"
)
op = tx["operations"][0][1]
self.assertIn(
"test",
op["from"])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment