From d65ad821304599986158188de8b0dd111789b5c6 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 15 Aug 2024 17:25:52 +0800 Subject: [PATCH] Problem: update voting_period is not tested (#1017) * Problem: update voting_period is not tested * Apply suggestions from code review Signed-off-by: yihuang * fix test --------- Signed-off-by: mmsqe Signed-off-by: yihuang Co-authored-by: yihuang --- integration_tests/test_gov.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/integration_tests/test_gov.py b/integration_tests/test_gov.py index edebc944a..e9b8e1248 100644 --- a/integration_tests/test_gov.py +++ b/integration_tests/test_gov.py @@ -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" @@ -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