feat: expose mocks

This commit is contained in:
2023-10-21 20:51:20 +02:00
parent fc005a74c3
commit 9eb969a4c3
2 changed files with 42 additions and 36 deletions

41
pkg/email/mock.go Normal file
View File

@@ -0,0 +1,41 @@
package email
import (
"crypto/tls"
"io"
"net/smtp"
)
type MockWriter struct{}
func (w *MockWriter) Close() error {
return nil
}
func (w *MockWriter) Write(p []byte) (n int, err error) {
return 10, nil
}
// Mock SMTP Client
type MockSMTP struct{}
func (m *MockSMTP) StartTLS(*tls.Config) error {
return nil
}
func (m *MockSMTP) Auth(a smtp.Auth) error {
return nil
}
func (m *MockSMTP) Close() error {
return nil
}
func (m *MockSMTP) Data() (io.WriteCloser, error) {
return &MockWriter{}, nil
}
func (m *MockSMTP) Mail(from string) error {
return nil
}
func (m *MockSMTP) Quit() error {
return nil
}
func (m *MockSMTP) Rcpt(to string) error {
return nil
}