forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR cosmos#5790: Standarize the representation of Governance par…
…am changes on cli requests.
- Loading branch information
Showing
7 changed files
with
99 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package cli | ||
|
||
import ( | ||
"io/ioutil" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
"github.com/cosmos/cosmos-sdk/x/params/client/utils" | ||
) | ||
|
||
func TestParseProposal(t *testing.T) { | ||
cdc := codec.New() | ||
okJSON, err := ioutil.TempFile("", "proposal") | ||
require.Nil(t, err, "unexpected error") | ||
okJSON.WriteString(` | ||
{ | ||
"title": "Staking Param Change", | ||
"description": "Update max validators", | ||
"changes": [ | ||
{ | ||
"subspace": "staking", | ||
"key": "MaxValidators", | ||
"value": 1 | ||
} | ||
], | ||
"deposit": "1000stake" | ||
} | ||
`) | ||
|
||
proposal, err := utils.ParseParamChangeProposalJSON(cdc, okJSON.Name()) | ||
require.NoError(t, err) | ||
|
||
require.Equal(t, "Staking Param Change", proposal.Title) | ||
require.Equal(t, "Update max validators", proposal.Description) | ||
require.Equal(t, "1000stake", proposal.Deposit) | ||
require.Equal(t, utils.ParamChangesJSON{ | ||
{ | ||
Subspace: "staking", | ||
Key: "MaxValidators", | ||
Value: []byte{0x31}, | ||
}, | ||
}, proposal.Changes) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters