simplify json handling in LCD tests
This commit is contained in:
parent
2dea46779c
commit
fb5fe9914d
|
@ -738,27 +738,22 @@ func doSendWithGas(t *testing.T, port, seed, name, password string, addr sdk.Acc
|
|||
panic(err)
|
||||
}
|
||||
|
||||
jsonStr := func() []byte {
|
||||
gasStr := ""
|
||||
if gas > 0 {
|
||||
return []byte(fmt.Sprintf(`{
|
||||
"name":"%s",
|
||||
"password":"%s",
|
||||
"account_number":"%d",
|
||||
"sequence":"%d",
|
||||
"amount":[%s],
|
||||
"chain_id":"%s",
|
||||
"gas":"%v"
|
||||
}`, name, password, accnum, sequence, coinbz, chainID, gas))
|
||||
gasStr = fmt.Sprintf(`
|
||||
"gas":"%v",
|
||||
`, gas)
|
||||
}
|
||||
return []byte(fmt.Sprintf(`{
|
||||
jsonStr := []byte(fmt.Sprintf(`{
|
||||
%v
|
||||
"name":"%s",
|
||||
"password":"%s",
|
||||
"account_number":"%d",
|
||||
"sequence":"%d",
|
||||
"amount":[%s],
|
||||
"chain_id":"%s"
|
||||
}`, name, password, accnum, sequence, coinbz, chainID))
|
||||
}()
|
||||
}`, gasStr, name, password, accnum, sequence, coinbz, chainID))
|
||||
|
||||
res, body = Request(t, port, "POST", fmt.Sprintf("/accounts/%s/send", receiveAddr), jsonStr)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue