Live Structure
This commit is contained in:
@@ -58,7 +58,7 @@ func TestExecSuccess(t *testing.T) {
|
||||
data, _ := json.Marshal(response)
|
||||
|
||||
caller.On("CallPost", url, "", mock.Anything).Return(data, nil)
|
||||
err := cache.Exec(url, tools.POST, map[string]string{"key": "value"}, caller)
|
||||
_, err := cache.Exec(url, tools.POST, map[string]string{"key": "value"}, caller)
|
||||
assert.NoError(t, err)
|
||||
caller.AssertExpectations(t)
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func TestExecReturnsErrorField(t *testing.T) {
|
||||
data, _ := json.Marshal(response)
|
||||
|
||||
caller.On("CallPost", url, "", mock.Anything).Return(data, nil)
|
||||
err := cache.Exec(url, tools.POST, map[string]string{"key": "value"}, caller)
|
||||
_, err := cache.Exec(url, tools.POST, map[string]string{"key": "value"}, caller)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, "something failed", err.Error())
|
||||
}
|
||||
@@ -81,7 +81,7 @@ func TestExecInvalidJSON(t *testing.T) {
|
||||
caller := &MockHTTPCaller{}
|
||||
url := "http://mockpeer/resource"
|
||||
caller.On("CallPost", url, "", mock.Anything).Return([]byte("{invalid json}"), nil)
|
||||
err := cache.Exec(url, tools.POST, map[string]string{"key": "value"}, caller)
|
||||
_, err := cache.Exec(url, tools.POST, map[string]string{"key": "value"}, caller)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "invalid character")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user