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