From be0a6ca1fc3761ccb0f666c76ab95d3db5cebd7c Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 26 Oct 2023 10:53:03 +0800 Subject: [PATCH] Problem: update voting_period is not tested --- integration_tests/cosmoscli.py | 17 +++++++++++++++++ integration_tests/test_gov.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/integration_tests/cosmoscli.py b/integration_tests/cosmoscli.py index 645b38afd..1fe262cca 100644 --- a/integration_tests/cosmoscli.py +++ b/integration_tests/cosmoscli.py @@ -186,6 +186,20 @@ def query_host_params(self): ) ) + def query_gov_params(self): + kwargs = { + "node": self.node_rpc, + "output": "json", + } + return json.loads( + self.raw( + "q", + "gov", + "params", + **kwargs, + ) + ) + class ClusterCLI(cluster.ClusterCLI): def __init__(self, *args, **kwargs): @@ -213,3 +227,6 @@ def sign_batch_multisig_tx(self, *args, i=0, **kwargs): def query_host_params(self, i=0): return self.cosmos_cli(i).query_host_params() + + def query_gov_params(self, i=0): + return self.cosmos_cli(i).query_gov_params() diff --git a/integration_tests/test_gov.py b/integration_tests/test_gov.py index b2bb950a3..3a022cd2b 100644 --- a/integration_tests/test_gov.py +++ b/integration_tests/test_gov.py @@ -310,7 +310,7 @@ def test_inherit_vote(cluster): def test_host_enabled(cluster): cli = cluster.cosmos_cli() - p = cluster.cosmos_cli().query_host_params() + p = cli.query_host_params() assert p["host_enabled"] rsp = cluster.gov_propose_legacy( "community", @@ -331,3 +331,30 @@ def test_host_enabled(cluster): approve_proposal(cluster, rsp) p = cli.query_host_params() assert not p["host_enabled"] + + +def test_gov_voting(cluster): + cli = cluster.cosmos_cli() + p = cli.query_gov_params() + assert p["voting_params"]["voting_period"] == "10000000000" + print("mm-query_gov_params", p) + voting_period = "21600" + rsp = cluster.gov_propose_legacy( + "community", + "param-change", + { + "title": "Update gov voting", + "description": "ditto", + "changes": [ + { + "subspace": "gov", + "key": "votingparams", + "value": {"voting_period": voting_period}, + } + ], + }, + ) + assert rsp["code"] == 0, rsp["raw_log"] + approve_proposal(cluster, rsp) + p = cli.query_gov_params() + assert p["voting_params"]["voting_period"] == voting_period