mock the mail server using a channel to read
This commit is contained in:
parent
b1d3095c89
commit
c88974788f
@ -39,6 +39,12 @@ func TestMain(m *testing.M) {
|
||||
|
||||
app.Session = session
|
||||
|
||||
mailChan := make(chan models.MailData)
|
||||
app.MailChan = mailChan
|
||||
defer close(mailChan)
|
||||
|
||||
listenForMail()
|
||||
|
||||
tc, err := CreateTestTemplateCache()
|
||||
if err != nil {
|
||||
log.Fatalf("cannot create template cache: %s", err)
|
||||
@ -135,3 +141,11 @@ func CreateTestTemplateCache() (map[string]*template.Template, error) {
|
||||
|
||||
return myCache, nil
|
||||
}
|
||||
|
||||
func listenForMail() {
|
||||
go func() {
|
||||
for {
|
||||
<-app.MailChan
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user