Skip to content

Commit

Permalink
add test for sanitizing pager team name
Browse files Browse the repository at this point in the history
  • Loading branch information
jspaleta committed Feb 19, 2021
1 parent d474a3e commit 6fafc32
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func Test_GetPagerDutyDedupKey(t *testing.T) {
}

func Test_PagerTeamToken(t *testing.T) {
//event := corev2.FixtureEvent("foo", "bar")
config.teamName = "test_team"
config.teamSuffix = "_test_suffix"
os.Setenv("test_team_test_suffix", "token_value")
Expand All @@ -118,6 +117,16 @@ func Test_PagerTeamToken(t *testing.T) {
assert.Equal(t, "token_value", teamToken)
}

func Test_PagerIllegalTeamToken(t *testing.T) {
config.teamName = "test-team"
config.teamSuffix = "_test-a-suffix"
os.Setenv("test_team_test_a_suffix", "token_value")
teamToken, err := getTeamToken()
assert.Nil(t, err)
assert.NotNil(t, teamToken)
assert.Equal(t, "token_value", teamToken)
}

func Test_GetSummary(t *testing.T) {
event := corev2.FixtureEvent("foo", "bar")
config.summaryTemplate = "{{.Entity.Name}}-{{.Check.Name}}"
Expand Down

0 comments on commit 6fafc32

Please sign in to comment.