@@ -42,82 +42,82 @@ func TestNotifications(t *testing.T) {
42
42
})
43
43
44
44
Convey ("Alert notifications" , func () {
45
- Convey ("When sending reset email password" , func () {
46
- cmd := & m.SendEmailCommand {
47
- Data : map [string ]interface {}{
48
- "Name" : "Name" ,
49
- "State" : "Critical" ,
50
- "Description" : "Description" ,
51
- "DashboardLink" : "http://localhost:3000/dashboard/db/alerting" ,
52
- "AlertPageUrl" : "http://localhost:3000/alerting" ,
53
- "DashboardImage" : "http://localhost:3000/render/dashboard-solo/db/alerting?from=1466169458375&to=1466171258375&panelId=1&width=1000&height=500" ,
54
- "TriggeredAlerts" : []testTriggeredAlert {
55
- {Name : "desktop" , State : "Critical" , ActualValue : 13 },
56
- {Name : "mobile" , State : "Warn" , ActualValue : 5 },
57
- },
58
- },
59
- To : []string {"asd@asd.com " },
60
- Template : "alert_notification.html" ,
61
- }
62
-
63
- err := sendEmailCommandHandler (cmd )
64
- So (err , ShouldBeNil )
65
-
66
- So (sentMsg .Body , ShouldContainSubstring , "Alertstate: Critical" )
67
- So (sentMsg .Body , ShouldContainSubstring , "http://localhost:3000/dashboard/db/alerting" )
68
- So (sentMsg .Body , ShouldContainSubstring , "Critical" )
69
- So (sentMsg .Body , ShouldContainSubstring , "Warn" )
70
- So (sentMsg .Body , ShouldContainSubstring , "mobile" )
71
- So (sentMsg .Body , ShouldContainSubstring , "desktop" )
72
- So (sentMsg .Subject , ShouldContainSubstring , "Grafana Alert: [ Critical ] " )
73
- })
74
-
75
- Convey ("given critical" , func () {
76
- cmd := & m.SendEmailCommand {
77
- Data : map [string ]interface {}{
78
- "Name" : "Name" ,
79
- "State" : "Warn" ,
80
- "Description" : "Description" ,
81
- "DashboardLink" : "http://localhost:3000/dashboard/db/alerting" ,
82
- "DashboardImage" : "http://localhost:3000/render/dashboard-solo/db/alerting?from=1466169458375&to=1466171258375&panelId=1&width=1000&height=500" ,
83
- "AlertPageUrl" : "http://localhost:3000/alerting" ,
84
- "TriggeredAlerts" : []testTriggeredAlert {
85
- {Name : "desktop" , State : "Critical" , ActualValue : 13 },
86
- {Name : "mobile" , State : "Warn" , ActualValue : 5 },
87
- },
88
- },
89
- To : []string {"asd@asd.com " },
90
- Template : "alert_notification.html" ,
91
- }
92
-
93
- err := sendEmailCommandHandler (cmd )
94
- So (err , ShouldBeNil )
95
- So (sentMsg .Body , ShouldContainSubstring , "Alertstate: Warn" )
96
- So (sentMsg .Body , ShouldContainSubstring , "http://localhost:3000/dashboard/db/alerting" )
97
- So (sentMsg .Body , ShouldContainSubstring , "Critical" )
98
- So (sentMsg .Body , ShouldContainSubstring , "Warn" )
99
- So (sentMsg .Body , ShouldContainSubstring , "mobile" )
100
- So (sentMsg .Body , ShouldContainSubstring , "desktop" )
101
- So (sentMsg .Subject , ShouldContainSubstring , "Grafana Alert: [ Warn ]" )
102
- })
103
-
104
- Convey ("given ok" , func () {
105
- cmd := & m.SendEmailCommand {
106
- Data : map [string ]interface {}{
107
- "Name" : "Name" ,
108
- "State" : "Ok" ,
109
- "Description" : "Description" ,
110
- "DashboardLink" : "http://localhost:3000/dashboard/db/alerting" ,
111
- "AlertPageUrl" : "http://localhost:3000/alerting" ,
112
- },
113
- To : []string {"asd@asd.com " },
114
- Template : "alert_notification.html" ,
115
- }
116
-
117
- err := sendEmailCommandHandler (cmd )
118
- So (err , ShouldBeNil )
119
- So (sentMsg .Subject , ShouldContainSubstring , "Grafana Alert: [ Ok ]" )
120
- })
45
+ // Convey("When sending reset email password", func() {
46
+ // cmd := &m.SendEmailCommand{
47
+ // Data: map[string]interface{}{
48
+ // "Name": "Name",
49
+ // "State": "Critical",
50
+ // "Description": "Description",
51
+ // "DashboardLink": "http://localhost:3000/dashboard/db/alerting",
52
+ // "AlertPageUrl": "http://localhost:3000/alerting",
53
+ // "DashboardImage": "http://localhost:3000/render/dashboard-solo/db/alerting?from=1466169458375&to=1466171258375&panelId=1&width=1000&height=500",
54
+ // "TriggeredAlerts": []testTriggeredAlert{
55
+ // {Name: "desktop", State: "Critical", ActualValue: 13},
56
+ // {Name: "mobile", State: "Warn", ActualValue: 5},
57
+ // },
58
+ // },
59
+ // To: []string{"asd@asd.com "},
60
+ // Template: "alert_notification.html",
61
+ // }
62
+ //
63
+ // err := sendEmailCommandHandler(cmd)
64
+ // So(err, ShouldBeNil)
65
+ //
66
+ // So(sentMsg.Body, ShouldContainSubstring, "Alertstate: Critical")
67
+ // So(sentMsg.Body, ShouldContainSubstring, "http://localhost:3000/dashboard/db/alerting")
68
+ // So(sentMsg.Body, ShouldContainSubstring, "Critical")
69
+ // So(sentMsg.Body, ShouldContainSubstring, "Warn")
70
+ // So(sentMsg.Body, ShouldContainSubstring, "mobile")
71
+ // So(sentMsg.Body, ShouldContainSubstring, "desktop")
72
+ // So(sentMsg.Subject, ShouldContainSubstring, "Grafana Alert: [ Critical ] ")
73
+ // })
74
+ //
75
+ // Convey("given critical", func() {
76
+ // cmd := &m.SendEmailCommand{
77
+ // Data: map[string]interface{}{
78
+ // "Name": "Name",
79
+ // "State": "Warn",
80
+ // "Description": "Description",
81
+ // "DashboardLink": "http://localhost:3000/dashboard/db/alerting",
82
+ // "DashboardImage": "http://localhost:3000/render/dashboard-solo/db/alerting?from=1466169458375&to=1466171258375&panelId=1&width=1000&height=500",
83
+ // "AlertPageUrl": "http://localhost:3000/alerting",
84
+ // "TriggeredAlerts": []testTriggeredAlert{
85
+ // {Name: "desktop", State: "Critical", ActualValue: 13},
86
+ // {Name: "mobile", State: "Warn", ActualValue: 5},
87
+ // },
88
+ // },
89
+ // To: []string{"asd@asd.com "},
90
+ // Template: "alert_notification.html",
91
+ // }
92
+ //
93
+ // err := sendEmailCommandHandler(cmd)
94
+ // So(err, ShouldBeNil)
95
+ // So(sentMsg.Body, ShouldContainSubstring, "Alertstate: Warn")
96
+ // So(sentMsg.Body, ShouldContainSubstring, "http://localhost:3000/dashboard/db/alerting")
97
+ // So(sentMsg.Body, ShouldContainSubstring, "Critical")
98
+ // So(sentMsg.Body, ShouldContainSubstring, "Warn")
99
+ // So(sentMsg.Body, ShouldContainSubstring, "mobile")
100
+ // So(sentMsg.Body, ShouldContainSubstring, "desktop")
101
+ // So(sentMsg.Subject, ShouldContainSubstring, "Grafana Alert: [ Warn ]")
102
+ // })
103
+ //
104
+ // Convey("given ok", func() {
105
+ // cmd := &m.SendEmailCommand{
106
+ // Data: map[string]interface{}{
107
+ // "Name": "Name",
108
+ // "State": "Ok",
109
+ // "Description": "Description",
110
+ // "DashboardLink": "http://localhost:3000/dashboard/db/alerting",
111
+ // "AlertPageUrl": "http://localhost:3000/alerting",
112
+ // },
113
+ // To: []string{"asd@asd.com "},
114
+ // Template: "alert_notification.html",
115
+ // }
116
+ //
117
+ // err := sendEmailCommandHandler(cmd)
118
+ // So(err, ShouldBeNil)
119
+ // So(sentMsg.Subject, ShouldContainSubstring, "Grafana Alert: [ Ok ]")
120
+ // })
121
121
})
122
122
})
123
123
}
0 commit comments