Skip to content

Commit

Permalink
Add tests for Rest client
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Jan 24, 2022
1 parent 3636c85 commit db7a4ba
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions x/wasm/client/proposal_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,76 @@ func TestGovRestHandlers(t *testing.T) {
},
expCode: http.StatusOK,
},
"execute contract": {
srcPath: "/gov/proposals/wasm_execute",
srcBody: dict{
"title": "Test Proposal",
"description": "My proposal",
"type": "migrate",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
"msg": dict{"foo": "bar"},
"run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
"deposit": []dict{{"denom": "ustake", "amount": "10"}},
"proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
"base_req": aBaseReq,
},
expCode: http.StatusOK,
},
"execute contract fails with no run_as": {
srcPath: "/gov/proposals/wasm_execute",
srcBody: dict{
"title": "Test Proposal",
"description": "My proposal",
"type": "migrate",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
"msg": dict{"foo": "bar"},
"deposit": []dict{{"denom": "ustake", "amount": "10"}},
"proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
"base_req": aBaseReq,
},
expCode: http.StatusBadRequest,
},
"execute contract fails with no message": {
srcPath: "/gov/proposals/wasm_execute",
srcBody: dict{
"title": "Test Proposal",
"description": "My proposal",
"type": "migrate",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
"run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
"deposit": []dict{{"denom": "ustake", "amount": "10"}},
"proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
"base_req": aBaseReq,
},
expCode: http.StatusBadRequest,
},
"sudo contract": {
srcPath: "/gov/proposals/wasm_sudo",
srcBody: dict{
"title": "Test Proposal",
"description": "My proposal",
"type": "migrate",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
"msg": dict{"foo": "bar"},
"deposit": []dict{{"denom": "ustake", "amount": "10"}},
"proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
"base_req": aBaseReq,
},
expCode: http.StatusOK,
},
"sudo contract fails with no message": {
srcPath: "/gov/proposals/wasm_sudo",
srcBody: dict{
"title": "Test Proposal",
"description": "My proposal",
"type": "migrate",
"contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
"deposit": []dict{{"denom": "ustake", "amount": "10"}},
"proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
"base_req": aBaseReq,
},
expCode: http.StatusBadRequest,
},
"update contract admin": {
srcPath: "/gov/proposals/wasm_update_admin",
srcBody: dict{
Expand Down

0 comments on commit db7a4ba

Please sign in to comment.