MCPcopy
hub / github.com/kopia/kopia / TestEmailProvider_Invalid

Function TestEmailProvider_Invalid

notification/sender/email/email_sender_test.go:169–185  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestEmailProvider_Invalid(t *testing.T) {
170 ctx := testlogging.Context(t)
171
172 cases := []struct {
173 opt email.Options
174 wantError string
175 }{
176 {opt: email.Options{}, wantError: "SMTP server must be provided"},
177 {opt: email.Options{SMTPServer: "some.server.com"}, wantError: "From address must be provided"},
178 {opt: email.Options{SMTPServer: "some.server.com", From: "some@example.com"}, wantError: "To address must be provided"},
179 }
180
181 for _, tc := range cases {
182 _, err := sender.GetSender(ctx, "my-profile", "email", &tc.opt)
183 require.ErrorContains(t, err, tc.wantError)
184 }
185}
186
187func TestMergeOptions(t *testing.T) {
188 var dst email.Options

Callers

nothing calls this directly

Calls 2

ContextFunction · 0.92
GetSenderFunction · 0.92

Tested by

no test coverage detected