email template - docs

pull/78/head
Hunter Long 2018-09-27 23:57:03 -07:00
parent 721b4ca96b
commit 81923a3b7c
6 changed files with 94 additions and 20 deletions

4
core/notifier/doc.go Normal file
View File

@ -0,0 +1,4 @@
// Package Notifier contains the main functionality for the Statup Notification system
//
// by Hunter Long
package notifier

File diff suppressed because one or more lines are too long

View File

@ -69,13 +69,11 @@ func TestEmailNotifier(t *testing.T) {
emailer.Port = int(EMAIL_PORT)
emailer.Delay = time.Duration(100 * time.Millisecond)
message := "this is a test email!"
testEmail = &EmailOutgoing{
To: emailer.GetValue("var2"),
Subject: fmt.Sprintf("Service %v is Failing", TestService.Name),
Template: MESSAGE,
Data: interface{}(message),
Template: TEMPLATE,
Data: TestService,
From: emailer.GetValue("var1"),
}
})

View File

@ -22,6 +22,7 @@ import (
"github.com/hunterlong/statup/utils"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"time"
)
var (
@ -31,6 +32,7 @@ var (
)
var TestService = &types.Service{
Id: 1,
Name: "Interpol - All The Rage Back Home",
Domain: "https://www.youtube.com/watch?v=-u6DvRyyKGU",
ExpectedStatus: 200,
@ -38,10 +40,16 @@ var TestService = &types.Service{
Type: "http",
Method: "GET",
Timeout: 20,
LastStatusCode: 404,
Expected: "test example",
LastResponse: "<html>this is an example response</html>",
CreatedAt: time.Now().Add(-24 * time.Hour),
}
var TestFailure = &types.Failure{
Issue: "testing",
Issue: "testing",
Service: 1,
CreatedAt: time.Now().Add(-12 * time.Hour),
}
var TestUser = &types.User{

View File

@ -24,13 +24,8 @@ import (
)
var (
SLACK_URL string
slackMessage = `{"text":"this is a test from the Slack notifier!"}`
slackTestMessage = SlackMessage{
Service: TestService,
Template: FAILURE,
Time: time.Now().Unix(),
}
SLACK_URL string
slackMessage = `{"text":"this is a test from the Slack notifier!"}`
)
func init() {

View File

@ -1,5 +1,4 @@
// Package type contains all of the structs for objects in Statup including
// services, hits, failures, Core, and others.
// Package types contains all of the structs for objects in Statup including services, hits, failures, Core, and others.
//
// by Hunter Long
package types