Skip to content

Commit

Permalink
Problem: create_vesting_account is not tested (#648)
Browse files Browse the repository at this point in the history
* add create_vesting_account test

* more var for end_time

* add end_time param
  • Loading branch information
mmsqe authored Aug 17, 2022
1 parent c093016 commit 4be9702
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
21 changes: 21 additions & 0 deletions integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,3 +1281,24 @@ def query_gravity_contract_by_denom(self, denom: str):
home=self.data_dir,
)
)

def create_vesting_account(self, to_address, amount, end_time, **kwargs):
"create vesting account"
default_kwargs = {
"home": self.data_dir,
"node": self.node_rpc,
"chain_id": self.chain_id,
"keyring_backend": "test",
}
return json.loads(
self.raw(
"tx",
"vesting",
"create-vesting-account",
to_address,
amount,
end_time,
"-y",
**(default_kwargs | kwargs),
)
)
22 changes: 22 additions & 0 deletions integration_tests/test_vesting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import time


def test_create_account(cronos):
"""
test create vesting account tx works:
"""
cli = cronos.cosmos_cli()
src = "vesting"
addr = cli.create_account(src)["address"]
denom = "basetcro"
balance = cli.balance(addr, denom)
assert balance == 0
amount = 10000
fee = 4000000000000000
amt = f"{amount}{denom}"
end_time = int(time.time()) + 3000
fees = f"{fee}{denom}"
res = cli.create_vesting_account(addr, amt, end_time, from_="validator", fees=fees)
assert res["code"] == 0, res["raw_log"]
balance = cli.balance(addr, denom)
assert balance == amount

0 comments on commit 4be9702

Please sign in to comment.