Skip to content

Commit 4be9702

Browse files
authored
Problem: create_vesting_account is not tested (#648)
* add create_vesting_account test * more var for end_time * add end_time param
1 parent c093016 commit 4be9702

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

integration_tests/cosmoscli.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,3 +1281,24 @@ def query_gravity_contract_by_denom(self, denom: str):
12811281
home=self.data_dir,
12821282
)
12831283
)
1284+
1285+
def create_vesting_account(self, to_address, amount, end_time, **kwargs):
1286+
"create vesting account"
1287+
default_kwargs = {
1288+
"home": self.data_dir,
1289+
"node": self.node_rpc,
1290+
"chain_id": self.chain_id,
1291+
"keyring_backend": "test",
1292+
}
1293+
return json.loads(
1294+
self.raw(
1295+
"tx",
1296+
"vesting",
1297+
"create-vesting-account",
1298+
to_address,
1299+
amount,
1300+
end_time,
1301+
"-y",
1302+
**(default_kwargs | kwargs),
1303+
)
1304+
)

integration_tests/test_vesting.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import time
2+
3+
4+
def test_create_account(cronos):
5+
"""
6+
test create vesting account tx works:
7+
"""
8+
cli = cronos.cosmos_cli()
9+
src = "vesting"
10+
addr = cli.create_account(src)["address"]
11+
denom = "basetcro"
12+
balance = cli.balance(addr, denom)
13+
assert balance == 0
14+
amount = 10000
15+
fee = 4000000000000000
16+
amt = f"{amount}{denom}"
17+
end_time = int(time.time()) + 3000
18+
fees = f"{fee}{denom}"
19+
res = cli.create_vesting_account(addr, amt, end_time, from_="validator", fees=fees)
20+
assert res["code"] == 0, res["raw_log"]
21+
balance = cli.balance(addr, denom)
22+
assert balance == amount

0 commit comments

Comments
 (0)