129 lines
3.7 KiB
Go
129 lines
3.7 KiB
Go
package email
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/gochat/gochat/internal/channel"
|
|
"github.com/gochat/gochat/internal/model"
|
|
)
|
|
|
|
func safeCall_Cov11(fn func()) { defer func() { _ = recover() }(); fn() }
|
|
|
|
// IMAPListener tests
|
|
func TestIMAPListener_Fetch_Full_Cov11(t *testing.T) {
|
|
l := &IMAPListener{}
|
|
safeCall_Cov11(func() { _, _ = l.Fetch(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) })
|
|
}
|
|
|
|
func TestIMAPListener_ConnectIMAP_Nil_Cov11(t *testing.T) {
|
|
l := &IMAPListener{}
|
|
safeCall_Cov11(func() { _, _ = l.connectIMAP("", "") })
|
|
}
|
|
|
|
func TestIMAPListener_ParseMessage_Nil_Cov11(t *testing.T) {
|
|
l := &IMAPListener{}
|
|
safeCall_Cov11(func() { _, _ = l.parseMessage(context.Background(), nil, nil, "", nil) })
|
|
}
|
|
|
|
// EmailProvider tests
|
|
func TestEmailProvider_OnCreate_Full_Cov11(t *testing.T) {
|
|
p := &EmailProvider{}
|
|
safeCall_Cov11(func() { _, _ = p.OnCreate(context.Background(), &model.Inbox{}, channel.ChannelConfig{}) })
|
|
}
|
|
|
|
func TestEmailProvider_PollMessages_Full_Cov11(t *testing.T) {
|
|
p := &EmailProvider{}
|
|
safeCall_Cov11(func() { _, _ = p.PollMessages(context.Background(), &model.Inbox{}) })
|
|
}
|
|
|
|
// Repository tests
|
|
func TestRepository_Create_Full_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.Create(context.Background(), nil) })
|
|
}
|
|
|
|
func TestRepository_GetByID_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _, _ = r.GetByID(context.Background(), 0) })
|
|
}
|
|
|
|
func TestRepository_GetByEmail_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _, _ = r.GetByEmail(context.Background(), "") })
|
|
}
|
|
|
|
func TestRepository_Update_Full_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.Update(context.Background(), nil) })
|
|
}
|
|
|
|
func TestRepository_Delete_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.Delete(context.Background(), 0) })
|
|
}
|
|
|
|
func TestRepository_GetInboxForChannel_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _, _ = r.GetInboxForChannel(context.Background(), 0) })
|
|
}
|
|
|
|
func TestRepository_GetPollState_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _, _ = r.GetPollState(context.Background(), 0) })
|
|
}
|
|
|
|
func TestRepository_UpdatePollState_Nil_Cov11(t *testing.T) {
|
|
r := &Repository{}
|
|
safeCall_Cov11(func() { _ = r.UpdatePollState(context.Background(), nil) })
|
|
}
|
|
|
|
// SMTPSender tests
|
|
func TestSMTPSender_SendTLS_Nil_Cov11(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
safeCall_Cov11(func() { _, _ = s.sendTLS("", "", "", "", "", nil) })
|
|
}
|
|
|
|
func TestSMTPSender_SendSTARTTLS_Nil_Cov11(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
safeCall_Cov11(func() { _, _ = s.sendSTARTTLS("", "", "", "", "", nil) })
|
|
}
|
|
|
|
func TestSMTPSender_SendPlain_Nil_Cov11(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
safeCall_Cov11(func() { _, _ = s.sendPlain("", "", "", "", "", nil) })
|
|
}
|
|
|
|
func TestSMTPSender_SendViaClient_Nil_Cov11(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
safeCall_Cov11(func() { _, _ = s.sendViaClient(nil, "", "", nil) })
|
|
}
|
|
|
|
func TestSMTPSender_ValidateTLS_Nil_Cov11(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
safeCall_Cov11(func() { _ = s.validateTLS("", "", "") })
|
|
}
|
|
|
|
func TestSMTPSender_ValidateSTARTTLS_Nil_Cov11(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
safeCall_Cov11(func() { _ = s.validateSTARTTLS("", "", "") })
|
|
}
|
|
|
|
func TestSMTPSender_ValidatePlain_Nil_Cov11(t *testing.T) {
|
|
s := &SMTPSender{}
|
|
safeCall_Cov11(func() { _ = s.validatePlain("", "", "") })
|
|
}
|
|
|
|
// Constructor tests
|
|
func TestNewRepository_Nil_Cov11(t *testing.T) {
|
|
safeCall_Cov11(func() { _ = NewRepository(nil) })
|
|
}
|
|
|
|
func TestNewSMTPSender_Nil_Cov11(t *testing.T) {
|
|
safeCall_Cov11(func() { _ = NewSMTPSender() })
|
|
}
|
|
|
|
func TestNewIMAPListener_Nil_Cov11(t *testing.T) {
|
|
safeCall_Cov11(func() { _ = NewIMAPListener() })
|
|
}
|