MCPcopy Create free account
hub / github.com/aws/aws-lambda-go / TestWrappedError

Function TestWrappedError

cfn/wrap_test.go:166–189  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

164}
165
166func 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
191func TestWrappedSendFailure(t *testing.T) {
192 client := &mockClient{

Callers

nothing calls this directly

Calls 2

extractResponseBodyFunction · 0.85
lambdaWrapWithClientFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…