mirror of
https://github.com/volatiletech/authboss.git
synced 2025-11-23 22:14:49 +02:00
Fix confirm's initial test.
- Add e-mail templates for confirm.
This commit is contained in:
47
confirm/confirm_test.go
Normal file
47
confirm/confirm_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package confirm
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
)
|
||||
|
||||
func setup() *Confirm {
|
||||
config := authboss.NewConfig()
|
||||
config.Storer = mocks.NewMockStorer()
|
||||
|
||||
config.LayoutEmail = template.Must(template.New("").Parse(`email ^_^`))
|
||||
|
||||
c := &Confirm{}
|
||||
if err := c.Initialize(config); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func TestConfirm_Initialize(t *testing.T) {
|
||||
c := &Confirm{}
|
||||
if err := c.Initialize(authboss.NewConfig()); err == nil {
|
||||
t.Error("Should cry about not having a storer.")
|
||||
}
|
||||
|
||||
c = setup()
|
||||
|
||||
if c.config == nil {
|
||||
t.Error("Missing config")
|
||||
}
|
||||
|
||||
if c.logger == nil {
|
||||
t.Error("Missing logger")
|
||||
}
|
||||
|
||||
if c.storer == nil {
|
||||
t.Error("Missing storer")
|
||||
}
|
||||
|
||||
if c.emailTemplates == nil {
|
||||
t.Error("Missing email templates")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user