File tree 2 files changed +44
-0
lines changed 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ package events
2
+
3
+ // CodePipelineJob has been incorrectly assigned as CodePipelineEvent
4
+ // - https://github.com/aws/aws-lambda-go/issues/244
5
+ // This maintains backwards compatability until a v2 release
6
+ type CodePipelineEvent = CodePipelineJobEvent
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ package events
3
+
4
+ import (
5
+ "encoding/json"
6
+ "io/ioutil"
7
+ "testing"
8
+
9
+ "github.com/aws/aws-lambda-go/events/test"
10
+ "github.com/stretchr/testify/assert"
11
+ )
12
+
13
+ func TestCodePipeLineJEventMarshaling (t * testing.T ) {
14
+
15
+ // read json from file
16
+ inputJSON , err := ioutil .ReadFile ("./testdata/codepipeline-job-event.json" )
17
+ if err != nil {
18
+ t .Errorf ("could not open test file. details: %v" , err )
19
+ }
20
+
21
+ // de-serialize into CognitoEvent
22
+ var inputEvent CodePipelineEvent
23
+ if err := json .Unmarshal (inputJSON , & inputEvent ); err != nil {
24
+ t .Errorf ("could not unmarshal event. details: %v" , err )
25
+ }
26
+
27
+ // serialize to json
28
+ outputJSON , err := json .Marshal (inputEvent )
29
+ if err != nil {
30
+ t .Errorf ("could not marshal event. details: %v" , err )
31
+ }
32
+
33
+ assert .JSONEq (t , string (inputJSON ), string (outputJSON ))
34
+ }
35
+
36
+ func TestCodePipelineEventMarshalingMalformedJson (t * testing.T ) {
37
+ test .TestMalformedJson (t , CodePipelineEvent {})
38
+ }
You can’t perform that action at this time.
0 commit comments