Skip to content

Commit

Permalink
test: webhook token
Browse files Browse the repository at this point in the history
  • Loading branch information
cugu committed Jul 21, 2024
1 parent c17c829 commit 075e312
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
31 changes: 4 additions & 27 deletions testing/reaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,17 @@ func TestWebhookReactions(t *testing.T) {
testSets := []catalystTest{
{
baseTest: BaseTest{
Name: "TriggerWebhookReaction",
Method: http.MethodGet,
URL: "/reaction/test",
Name: "TriggerWebhookReaction",
Method: http.MethodGet,
RequestHeaders: map[string]string{"Authorization": "Bearer 1234567890"},
URL: "/reaction/test",
},
userTests: []UserTest{
{
Name: "Unauthorized",
ExpectedStatus: http.StatusOK,
ExpectedContent: []string{`Hello, World!`},
},
{
Name: "Analyst",
AuthRecord: analystEmail,
ExpectedStatus: http.StatusOK,
ExpectedContent: []string{`Hello, World!`},
},
{
Name: "Admin",
Admin: adminEmail,
ExpectedStatus: http.StatusOK,
ExpectedContent: []string{`Hello, World!`},
},
},
},
{
Expand All @@ -58,18 +47,6 @@ func TestWebhookReactions(t *testing.T) {
ExpectedStatus: http.StatusOK,
ExpectedContent: []string{`"test":true`},
},
{
Name: "Analyst",
AuthRecord: analystEmail,
ExpectedStatus: http.StatusOK,
ExpectedContent: []string{`"test":true`},
},
{
Name: "Admin",
Admin: adminEmail,
ExpectedStatus: http.StatusOK,
ExpectedContent: []string{`"test":true`},
},
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion testing/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func reactionTestData(t *testing.T, app core.App) {
record.SetId("r_reaction")
record.Set("name", "Reaction")
record.Set("trigger", "webhook")
record.Set("triggerdata", `{"path":"test"}`)
record.Set("triggerdata", `{"token":"1234567890","path":"test"}`)
record.Set("action", "python")
record.Set("actiondata", `{"requirements":"requests","script":"print('Hello, World!')"}`)

Expand Down

0 comments on commit 075e312

Please sign in to comment.