github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/pkg/emailer/service_mock.go (about) 1 package emailer 2 3 import ( 4 "testing" 5 6 "github.com/cozy/cozy-stack/model/instance" 7 "github.com/stretchr/testify/mock" 8 ) 9 10 // Mock implementation of [Emailer]. 11 type Mock struct { 12 mock.Mock 13 } 14 15 // NewMock instantiates a new [Mock]. 16 func NewMock(t *testing.T) *Mock { 17 m := new(Mock) 18 m.Test(t) 19 t.Cleanup(func() { m.AssertExpectations(t) }) 20 21 return m 22 } 23 24 // SendEmail mock method. 25 func (m *Mock) SendEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error { 26 return m.Called(inst, cmd).Error(0) 27 } 28 29 // SendPendingEmail mock method. 30 func (m *Mock) SendPendingEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error { 31 return m.Called(inst, cmd).Error(0) 32 } 33 34 // SendCampaignEmail mock method 35 func (m *Mock) SendCampaignEmail(inst *instance.Instance, cmd *CampaignEmailCmd) error { 36 return m.Called(inst, cmd).Error(0) 37 }