1414package pushover
1515
1616import (
17+ "net/http"
1718 "os"
1819 "testing"
1920
@@ -22,7 +23,9 @@ import (
2223 "github.com/stretchr/testify/require"
2324
2425 "github.com/prometheus/alertmanager/config"
26+ "github.com/prometheus/alertmanager/notify"
2527 "github.com/prometheus/alertmanager/notify/test"
28+ "github.com/prometheus/alertmanager/types"
2629)
2730
2831func TestPushoverRetry (t * testing.T ) {
@@ -109,3 +112,27 @@ func TestPushoverReadingTokenFromFile(t *testing.T) {
109112
110113 test .AssertNotifyLeaksNoSecret (ctx , t , notifier , token )
111114}
115+
116+ func TestPushoverMonospaceParameter (t * testing.T ) {
117+ ctx , apiURL , fn := test .GetContextWithCancelingURL (func (w http.ResponseWriter , r * http.Request ) {
118+ require .NoError (t , r .ParseForm ())
119+ require .Equal (t , "1" , r .FormValue ("monospace" ), `expected monospace parameter to be set to "1"` )
120+ })
121+ defer fn ()
122+
123+ notifier , err := New (
124+ & config.PushoverConfig {
125+ UserKey : config .Secret ("user_key" ),
126+ Token : config .Secret ("token" ),
127+ Monospace : true ,
128+ HTTPConfig : & commoncfg.HTTPClientConfig {},
129+ },
130+ test .CreateTmpl (t ),
131+ promslog .NewNopLogger (),
132+ )
133+ notifier .apiURL = apiURL .String ()
134+ require .NoError (t , err )
135+
136+ _ , err = notifier .Notify (notify .WithGroupKey (ctx , "1" ), & types.Alert {})
137+ require .NoError (t , err )
138+ }
0 commit comments