Skip to content

Commit

Permalink
Fix : Add mock IsMethodIgnored() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
OBlackmon3 committed Oct 24, 2024
1 parent 7f78b3a commit 022ae3f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions erpc/evm_json_rpc_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {

mockConnector.On("Set", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)

err := cache.Set(context.Background(), req, resp)

Expand All @@ -97,6 +98,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {

mockConnector.On("Set", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)

err := cache.Set(context.Background(), req, resp)

Expand Down Expand Up @@ -150,6 +152,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {

mockConnector.On("Set", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)

err := cache.Set(context.Background(), req, resp)

Expand All @@ -170,6 +173,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {

mockConnector.On("Set", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)

err := cache.Set(context.Background(), req, resp)

Expand All @@ -184,6 +188,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {
resp := common.NewNormalizedResponse().WithBody([]byte(`{"result":{"number":"0x399","hash":"0xdef"}}`))

mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)
err := cache.Set(context.Background(), req, resp)

assert.NoError(t, err)
Expand All @@ -198,6 +203,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {
resp := common.NewNormalizedResponse().WithBody([]byte(`{"result":"0x0"}`))

mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)
err := cache.Set(context.Background(), req, resp)

assert.NoError(t, err)
Expand All @@ -212,6 +218,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {
resp := common.NewNormalizedResponse().WithBody([]byte(`{"result":"0x0"}`))

mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)
err := cache.Set(context.Background(), req, resp)

assert.NoError(t, err)
Expand All @@ -226,6 +233,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {
resp := common.NewNormalizedResponse().WithBody([]byte(`{"result":"0x0"}`))

mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)
err := cache.Set(context.Background(), req, resp)

assert.NoError(t, err)
Expand All @@ -240,6 +248,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {
resp := common.NewNormalizedResponse().WithBody([]byte(`{"result":"0x0"}`))

mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)
err := cache.Set(context.Background(), req, resp)

assert.NoError(t, err)
Expand All @@ -255,6 +264,7 @@ func TestEvmJsonRpcCache_Set(t *testing.T) {

mockConnector.On("Set", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)

err := cache.Set(context.Background(), req, resp)

Expand All @@ -273,6 +283,7 @@ func TestEvmJsonRpcCache_Get(t *testing.T) {
cachedResponse := `{"number":"0x1","hash":"0xabc"}`
mockConnector.On("Get", mock.Anything, mock.Anything, "evm:123:1", mock.Anything).Return(cachedResponse, nil)
mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)

resp, err := cache.Get(context.Background(), req)

Expand All @@ -290,6 +301,7 @@ func TestEvmJsonRpcCache_Get(t *testing.T) {
req := common.NewNormalizedRequest([]byte(`{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x32345",false],"id":1}`))
req.SetNetwork(mockNetwork)
mockConnector.On("HasTTL", mock.AnythingOfType("string")).Return(false)
mockConnector.On("IsMethodIgnored", mock.AnythingOfType("string")).Return(false)
resp, err := cache.Get(context.Background(), req)

assert.NoError(t, err)
Expand Down

0 comments on commit 022ae3f

Please sign in to comment.