(t *testing.T)
| 126 | } |
| 127 | |
| 128 | func TestContextPlumbing(t *testing.T) { |
| 129 | srv := NewFunction(testWrapperHandler( |
| 130 | func(ctx context.Context, input []byte) (interface{}, error) { |
| 131 | lc, _ := lambdacontext.FromContext(ctx) |
| 132 | return lc, nil |
| 133 | }, |
| 134 | )) |
| 135 | var response messages.InvokeResponse |
| 136 | err := srv.Invoke(&messages.InvokeRequest{ |
| 137 | CognitoIdentityId: "dummyident", |
| 138 | CognitoIdentityPoolId: "dummypool", |
| 139 | ClientContext: []byte(`{ |
| 140 | "Client": { |
| 141 | "app_title": "dummytitle", |
| 142 | "installation_id": "dummyinstallid", |
| 143 | "app_version_code": "dummycode", |
| 144 | "app_package_name": "dummyname" |
| 145 | } |
| 146 | }`), |
| 147 | RequestId: "dummyid", |
| 148 | InvokedFunctionArn: "dummyarn", |
| 149 | }, &response) |
| 150 | assert.NoError(t, err) |
| 151 | assert.NotNil(t, response.Payload) |
| 152 | expected := ` |
| 153 | { |
| 154 | "AwsRequestID": "dummyid", |
| 155 | "InvokedFunctionArn": "dummyarn", |
| 156 | "Identity": { |
| 157 | "CognitoIdentityID": "dummyident", |
| 158 | "CognitoIdentityPoolID": "dummypool" |
| 159 | }, |
| 160 | "ClientContext": { |
| 161 | "Client": { |
| 162 | "installation_id": "dummyinstallid", |
| 163 | "app_title": "dummytitle", |
| 164 | "app_version_code": "dummycode", |
| 165 | "app_package_name": "dummyname" |
| 166 | }, |
| 167 | "env": null, |
| 168 | "custom": null |
| 169 | } |
| 170 | } |
| 171 | ` |
| 172 | assert.JSONEq(t, expected, string(response.Payload)) |
| 173 | } |
| 174 | |
| 175 | func TestXAmznTraceID(t *testing.T) { |
| 176 | type XRayResponse struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…