Skip to content

Commit a8deb47

Browse files
committed
add test data
1 parent 38a38c7 commit a8deb47

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

events/apigw_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,3 +434,45 @@ func TestApiGatewayV2HTTPRequestNoAuthorizerMarshaling(t *testing.T) {
434434

435435
assert.JSONEq(t, string(inputJSON), string(outputJSON))
436436
}
437+
438+
func TestApiGatewayV2CustomAuthorizerV1RequestMarshaling(t *testing.T) {
439+
inputJSON, err := ioutil.ReadFile("./testdata/apigw-v2-custom-authorizer-v1-request.json")
440+
if err != nil {
441+
t.Errorf("could not open test file. details: %v", err)
442+
}
443+
444+
// de-serialize into Go object
445+
var inputEvent APIGatewayV2CustomAuthorizerV1Request
446+
if err := json.Unmarshal(inputJSON, &inputEvent); err != nil {
447+
t.Errorf("could not unmarshal event. details: %v", err)
448+
}
449+
450+
// serialize to json
451+
outputJSON, err := json.Marshal(inputEvent)
452+
if err != nil {
453+
t.Errorf("could not marshal event. details: %v", err)
454+
}
455+
456+
assert.JSONEq(t, string(inputJSON), string(outputJSON))
457+
}
458+
459+
func TestApiGatewayV2CustomAuthorizerV2RequestMarshaling(t *testing.T) {
460+
inputJSON, err := ioutil.ReadFile("./testdata/apigw-v2-custom-authorizer-v2-request.json")
461+
if err != nil {
462+
t.Errorf("could not open test file. details: %v", err)
463+
}
464+
465+
// de-serialize into Go object
466+
var inputEvent APIGatewayV2CustomAuthorizerV2Request
467+
if err := json.Unmarshal(inputJSON, &inputEvent); err != nil {
468+
t.Errorf("could not unmarshal event. details: %v", err)
469+
}
470+
471+
// serialize to json
472+
outputJSON, err := json.Marshal(inputEvent)
473+
if err != nil {
474+
t.Errorf("could not marshal event. details: %v", err)
475+
}
476+
477+
assert.JSONEq(t, string(inputJSON), string(outputJSON))
478+
}

0 commit comments

Comments
 (0)