-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace slack token with webhook url
PDOK-16153
- Loading branch information
1 parent
9c7c52f
commit f72a59d
Showing
5 changed files
with
58 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package service | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestSlack_Send(t *testing.T) { | ||
t.Skip() // only for local testing | ||
type slackConfig struct { | ||
webhookURL string | ||
channelID string | ||
} | ||
tests := []struct { | ||
name string | ||
fields slackConfig | ||
message string | ||
}{ | ||
{ | ||
name: "test send to some webhook url", | ||
fields: slackConfig{ | ||
webhookURL: os.Getenv("SLACK_WEBHOOK_URL"), // secret! | ||
channelID: os.Getenv("SLACK_CHANNEL_ID"), | ||
}, | ||
message: ":warning:\ntest", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(_ *testing.T) { | ||
s := &Slack{ | ||
webhookURL: tt.fields.webhookURL, | ||
channelID: tt.fields.channelID, | ||
} | ||
s.Send(context.TODO(), tt.message) | ||
}) | ||
} | ||
} |