-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from thrawn01/webhooks-2.0
Added support for webhooks 2.0
- Loading branch information
Showing
9 changed files
with
223 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,13 @@ import ( | |
) | ||
|
||
func TestParseErrors(t *testing.T) { | ||
_, err := parse([]byte("")) | ||
_, err := ParseEvent([]byte("")) | ||
ensure.DeepEqual(t, err.Error(), "failed to recognize event: EOF") | ||
|
||
_, err = parse([]byte(`{"event": "unknown_event"}`)) | ||
_, err = ParseEvent([]byte(`{"event": "unknown_event"}`)) | ||
ensure.DeepEqual(t, err.Error(), "unsupported event: 'unknown_event'") | ||
|
||
_, err = parse([]byte(`{ | ||
_, err = ParseEvent([]byte(`{ | ||
"event": "accepted", | ||
"timestamp": "1420255392.850187" | ||
}`)) | ||
|
@@ -26,7 +26,7 @@ func TestParseErrors(t *testing.T) { | |
} | ||
|
||
func TestParseSuccess(t *testing.T) { | ||
event, err := parse([]byte(`{ | ||
event, err := ParseEvent([]byte(`{ | ||
"event": "accepted", | ||
"timestamp": 1420255392.850187, | ||
"user-variables": "{}", | ||
|
@@ -75,7 +75,7 @@ func TestParseSuccess(t *testing.T) { | |
ensure.DeepEqual(t, subject, "Test message going through the bus.") | ||
|
||
// Make sure the next event parsing attempt will zero the fields. | ||
event2, err := parse([]byte(`{ | ||
event2, err := ParseEvent([]byte(`{ | ||
"event": "accepted", | ||
"timestamp": 1533922516.538978, | ||
"recipient": "[email protected]" | ||
|
@@ -133,7 +133,7 @@ func TestTimeStamp(t *testing.T) { | |
|
||
func TestEventNames(t *testing.T) { | ||
for name := range EventNames { | ||
event, err := parse([]byte(fmt.Sprintf(`{"event": "%s"}`, name))) | ||
event, err := ParseEvent([]byte(fmt.Sprintf(`{"event": "%s"}`, name))) | ||
ensure.Nil(t, err) | ||
ensure.DeepEqual(t, event.GetName(), name) | ||
} | ||
|
@@ -152,7 +152,7 @@ func TestEventMessageWithAttachment(t *testing.T) { | |
"content-type": "application/pdf", | ||
"size": 139214}], | ||
"size": 142698}}`) | ||
event, err := parse(body) | ||
event, err := ParseEvent(body) | ||
ensure.Nil(t, err) | ||
ensure.DeepEqual(t, event.(*events.Delivered).Message.Attachments[0].FileName, "doc.pdf") | ||
} | ||
|
@@ -166,7 +166,7 @@ func TestStored(t *testing.T) { | |
"key": "%s", | ||
"url": "%s" | ||
}}`, key, url)) | ||
event, err := parse(body) | ||
event, err := ParseEvent(body) | ||
ensure.Nil(t, err) | ||
ensure.DeepEqual(t, event.(*events.Stored).Storage.Key, key) | ||
ensure.DeepEqual(t, event.(*events.Stored).Storage.URL, url) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.