(t *testing.T)
| 164 | } |
| 165 | |
| 166 | func TestWrappedError(t *testing.T) { |
| 167 | client := &mockClient{ |
| 168 | DoFunc: func(req *http.Request) (*http.Response, error) { |
| 169 | response := extractResponseBody(t, req) |
| 170 | |
| 171 | assert.Equal(t, StatusFailed, response.Status) |
| 172 | assert.Equal(t, testEvent.PhysicalResourceID, response.PhysicalResourceID) |
| 173 | assert.Equal(t, "failed to create resource", response.Reason) |
| 174 | |
| 175 | return &http.Response{ |
| 176 | StatusCode: http.StatusOK, |
| 177 | Body: nopCloser{bytes.NewBufferString("")}, |
| 178 | }, nil |
| 179 | }, |
| 180 | } |
| 181 | |
| 182 | fn := func(ctx context.Context, event Event) (physicalResourceID string, data map[string]interface{}, err error) { |
| 183 | err = errors.New("failed to create resource") |
| 184 | return |
| 185 | } |
| 186 | |
| 187 | _, err := lambdaWrapWithClient(fn, client)(context.TODO(), *testEvent) |
| 188 | assert.NoError(t, err) |
| 189 | } |
| 190 | |
| 191 | func TestWrappedSendFailure(t *testing.T) { |
| 192 | client := &mockClient{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…