Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
4c4164bb
Commit
4c4164bb
authored
Jun 20, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(alerting): adds test email creater
parent
adea539b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
pkg/services/notifications/send_email_integration_test.go
+55
-0
No files found.
pkg/services/notifications/send_email_integration_test.go
0 → 100644
View file @
4c4164bb
package
notifications
import
(
"io/ioutil"
"testing"
"github.com/grafana/grafana/pkg/bus"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
.
"github.com/smartystreets/goconvey/convey"
)
func
TestEmailIntegrationTest
(
t
*
testing
.
T
)
{
SkipConvey
(
"Given the notifications service"
,
t
,
func
()
{
bus
.
ClearBusHandlers
()
setting
.
StaticRootPath
=
"../../../public/"
setting
.
Smtp
.
Enabled
=
true
setting
.
Smtp
.
TemplatesPattern
=
"emails/*.html"
setting
.
Smtp
.
FromAddress
=
"from@address.com"
err
:=
Init
()
So
(
err
,
ShouldBeNil
)
var
sentMsg
*
Message
addToMailQueue
=
func
(
msg
*
Message
)
{
sentMsg
=
msg
ioutil
.
WriteFile
(
"../../../tmp/test_email.html"
,
[]
byte
(
msg
.
Body
),
0777
)
}
Convey
(
"When sending reset email password"
,
func
()
{
cmd
:=
&
m
.
SendEmailCommand
{
Data
:
map
[
string
]
interface
{}{
"Name"
:
"Name"
,
"State"
:
"Critical"
,
"Description"
:
"Description"
,
"DashboardLink"
:
"http://localhost:3000/dashboard/db/alerting"
,
"AlertPageUrl"
:
"http://localhost:3000/alerting"
,
"DashboardImage"
:
"http://localhost:3000/render/dashboard-solo/db/alerting?from=1466169458375&to=1466171258375&panelId=3&width=1000&height=500"
,
"TriggeredAlerts"
:
[]
testTriggeredAlert
{
{
Name
:
"desktop"
,
State
:
"Critical"
,
ActualValue
:
13
},
{
Name
:
"mobile"
,
State
:
"Warn"
,
ActualValue
:
5
},
},
},
To
:
[]
string
{
"asd@asd.com "
},
Template
:
"alert_notification.html"
,
}
err
:=
sendEmailCommandHandler
(
cmd
)
So
(
err
,
ShouldBeNil
)
})
})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment