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.Port = int(EMAIL_PORT)
emailer.Delay = time.Duration(100 * time.Millisecond) emailer.Delay = time.Duration(100 * time.Millisecond)
message := "this is a test email!"
testEmail = &EmailOutgoing{ testEmail = &EmailOutgoing{
To: emailer.GetValue("var2"), To: emailer.GetValue("var2"),
Subject: fmt.Sprintf("Service %v is Failing", TestService.Name), Subject: fmt.Sprintf("Service %v is Failing", TestService.Name),
Template: MESSAGE, Template: TEMPLATE,
Data: interface{}(message), Data: TestService,
From: emailer.GetValue("var1"), From: emailer.GetValue("var1"),
} }
}) })

View File

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

View File

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

View File

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