Merge PR #188: Add linting to CI
* Add some linting to gaia - closes #187 Signed-off-by: Marko Baricevic <marbar3778@yahoo.com> * fail tests * tests pass * address PR comments * some more strictness
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//nolint:unused,deadcode,bodyclose
|
||||
package lcdtest
|
||||
|
||||
import (
|
||||
@@ -115,7 +116,7 @@ func getBlock(t *testing.T, port string, height int, expectFail bool) ctypes.Res
|
||||
|
||||
func extractResultFromResponse(t *testing.T, body []byte) []byte {
|
||||
var resp rest.ResponseWithHeight
|
||||
require.NoError(t, cdc.UnmarshalJSON([]byte(body), &resp))
|
||||
require.NoError(t, cdc.UnmarshalJSON(body, &resp))
|
||||
|
||||
return resp.Result
|
||||
}
|
||||
@@ -155,6 +156,7 @@ func getTransaction(t *testing.T, port string, hash string) sdk.TxResponse {
|
||||
|
||||
err := cdc.UnmarshalJSON([]byte(body), &tx)
|
||||
require.NoError(t, err)
|
||||
|
||||
return tx
|
||||
}
|
||||
|
||||
@@ -176,6 +178,7 @@ func getTransactions(t *testing.T, port string, tags ...string) *sdk.SearchTxsRe
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
err := cdc.UnmarshalJSON([]byte(body), &result)
|
||||
|
||||
require.NoError(t, err)
|
||||
return &result
|
||||
}
|
||||
@@ -190,6 +193,7 @@ func getKeys(t *testing.T, port string) []keys.KeyOutput {
|
||||
var m []keys.KeyOutput
|
||||
err := cdc.UnmarshalJSON([]byte(body), &m)
|
||||
require.Nil(t, err)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
@@ -205,6 +209,7 @@ func doKeysPost(t *testing.T, port, name, password, mnemonic string, account int
|
||||
var resp keys.KeyOutput
|
||||
err = cdc.UnmarshalJSON([]byte(body), &resp)
|
||||
require.Nil(t, err, body)
|
||||
|
||||
return resp
|
||||
}
|
||||
|
||||
@@ -212,10 +217,10 @@ func doKeysPost(t *testing.T, port, name, password, mnemonic string, account int
|
||||
func getKeysSeed(t *testing.T, port string) string {
|
||||
res, body := Request(t, port, "GET", "/keys/seed", nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
reg, err := regexp.Compile(`([a-z]+ ){12}`)
|
||||
require.Nil(t, err)
|
||||
reg := regexp.MustCompile(`([a-z]+ ){12}`)
|
||||
match := reg.MatchString(body)
|
||||
require.True(t, match, "Returned seed has wrong format", body)
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
@@ -244,6 +249,7 @@ func getKey(t *testing.T, port, name string) keys.KeyOutput {
|
||||
var resp keys.KeyOutput
|
||||
err := cdc.UnmarshalJSON([]byte(body), &resp)
|
||||
require.Nil(t, err)
|
||||
|
||||
return resp
|
||||
}
|
||||
|
||||
@@ -259,6 +265,7 @@ func updateKey(t *testing.T, port, name, oldPassword, newPassword string, fail b
|
||||
return
|
||||
}
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
}
|
||||
|
||||
// GET /auth/accounts/{address} Get the account information on blockchain
|
||||
@@ -1129,10 +1136,6 @@ func doUnjail(
|
||||
return txResp
|
||||
}
|
||||
|
||||
type unjailReq struct {
|
||||
BaseReq rest.BaseReq `json:"base_req"`
|
||||
}
|
||||
|
||||
// ICS24 - fee distribution
|
||||
|
||||
// POST /distribution/delegators/{delgatorAddr}/rewards Withdraw delegator rewards
|
||||
@@ -1165,11 +1168,3 @@ func doWithdrawDelegatorAllRewards(
|
||||
|
||||
return txResp
|
||||
}
|
||||
|
||||
func mustParseDecCoins(dcstring string) sdk.DecCoins {
|
||||
dcoins, err := sdk.ParseDecCoins(dcstring)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return dcoins
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user