Fix inconsistency between api doc and code: hermezEthereumAddress => hezEthereumAddress

This commit is contained in:
Arnau B
2020-12-16 12:29:46 +01:00
parent 8e1bfd150d
commit 226c49f28f
6 changed files with 18 additions and 13 deletions

View File

@@ -81,14 +81,14 @@ func TestGetAccounts(t *testing.T) {
assert.LessOrEqual(t, len(fetchedAccounts), len(tc.accounts))
fetchedAccounts = []testAccount{}
// Filter by ethAddr
path = fmt.Sprintf("%s?hermezEthereumAddress=%s&limit=%d", endpoint, tc.accounts[3].EthAddr, limit)
path = fmt.Sprintf("%s?hezEthereumAddress=%s&limit=%d", endpoint, tc.accounts[3].EthAddr, limit)
err = doGoodReqPaginated(path, historydb.OrderAsc, &testAccountsResponse{}, appendIter)
assert.NoError(t, err)
assert.Greater(t, len(fetchedAccounts), 0)
assert.LessOrEqual(t, len(fetchedAccounts), len(tc.accounts))
fetchedAccounts = []testAccount{}
// both filters (incompatible)
path = fmt.Sprintf("%s?hermezEthereumAddress=%s&BJJ=%s&limit=%d", endpoint, tc.accounts[0].EthAddr, tc.accounts[0].PublicKey, limit)
path = fmt.Sprintf("%s?hezEthereumAddress=%s&BJJ=%s&limit=%d", endpoint, tc.accounts[0].EthAddr, tc.accounts[0].PublicKey, limit)
err = doBadReq("GET", path, nil, 400)
assert.NoError(t, err)
fetchedAccounts = []testAccount{}
@@ -144,6 +144,11 @@ func TestGetAccounts(t *testing.T) {
assert.Equal(t, reversedAccounts[i], fetchedAccounts[len(fetchedAccounts)-1-i])
}
// 400
path = fmt.Sprintf("%s?hezEthereumAddress=hez:0x123456", endpoint)
err = doBadReq("GET", path, nil, 400)
assert.NoError(t, err)
// Test GetAccount
path = fmt.Sprintf("%s/%s", endpoint, fetchedAccounts[2].Idx)
account := testAccount{}