Skip to content

Commit

Permalink
Problem: update voting_period is not tested (#1017)
Browse files Browse the repository at this point in the history
* Problem: update voting_period is not tested

* Apply suggestions from code review

Signed-off-by: yihuang <[email protected]>

* fix test

---------

Signed-off-by: mmsqe <[email protected]>
Signed-off-by: yihuang <[email protected]>
Co-authored-by: yihuang <[email protected]>
  • Loading branch information
mmsqe and yihuang authored Aug 15, 2024
1 parent c26a336 commit f26b2cc
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion integration_tests/test_gov.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def test_inherit_vote(cluster, tmp_path):

def test_host_enabled(cluster, tmp_path):
cli = cluster.cosmos_cli()
p = cluster.cosmos_cli().query_host_params()
p = cli.query_host_params()
assert p["host_enabled"]
p["host_enabled"] = False
proposal = tmp_path / "proposal.json"
Expand All @@ -247,3 +247,35 @@ def test_host_enabled(cluster, tmp_path):
approve_proposal(cluster, rsp, msg=msg)
p = cli.query_host_params()
assert not p["host_enabled"]


def test_gov_voting(cluster, tmp_path):
"""
- change voting_period from default 10s to 3m36s
"""
cli = cluster.cosmos_cli()
p = cli.query_params("gov")
assert p["params"]["voting_period"] == "10s"
updated = "3m36s"
p["params"]["voting_period"] = updated
proposal = tmp_path / "proposal.json"
authority = module_address("gov")
type = "/cosmos.gov.v1.MsgUpdateParams"
proposal_src = {
"messages": [
{
"@type": type,
"authority": authority,
"params": p["params"],
}
],
"deposit": "10000000basecro",
"title": "title",
"summary": "summary",
}
proposal.write_text(json.dumps(proposal_src))
rsp = cluster.submit_gov_proposal(proposal, from_="community")
assert rsp["code"] == 0, rsp["raw_log"]
approve_proposal(cluster, rsp, msg=f",{type}")
p = cli.query_params("gov")
assert p["params"]["voting_period"] == updated

0 comments on commit f26b2cc

Please sign in to comment.