working on auth.
mailer, basic setup with html template and a dev treansport
This commit is contained in:
31
mailer/message/render_test.go
Normal file
31
mailer/message/render_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package message
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type testmail struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
func (t testmail) Subject() string {
|
||||
return "Test Test"
|
||||
}
|
||||
|
||||
func (t testmail) HtmlBody() (string, error) {
|
||||
content := `<p>{{.Message}}</p>`
|
||||
return render(layout, content, t)
|
||||
}
|
||||
|
||||
func TestRender(t *testing.T) {
|
||||
tpl := testmail{
|
||||
Message: "some mesage",
|
||||
}
|
||||
|
||||
if b, err := tpl.HtmlBody(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !strings.Contains(b, tpl.Message) {
|
||||
t.Error("supposed to contain:", tpl.Message)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user