Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 464b244

Browse files
committed
chore(coderd/notifications): rename a test package
1 parent 4991c33 commit 464b244

File tree

14 files changed

+18
-18
lines changed

14 files changed

+18
-18
lines changed

coderd/notifications/dispatch/smtp_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/coder/serpent"
2020

2121
"github.com/coder/coder/v2/coderd/notifications/dispatch"
22-
"github.com/coder/coder/v2/coderd/notifications/dispatch/mocksmtp"
22+
"github.com/coder/coder/v2/coderd/notifications/dispatch/smtptest"
2323
"github.com/coder/coder/v2/coderd/notifications/types"
2424
"github.com/coder/coder/v2/codersdk"
2525
"github.com/coder/coder/v2/testutil"
@@ -45,9 +45,9 @@ func TestSMTP(t *testing.T) {
4545
subject = "This is the subject"
4646
body = "This is the body"
4747

48-
caFile = "mocksmtp/fixtures/ca.crt"
49-
certFile = "mocksmtp/fixtures/server.crt"
50-
keyFile = "mocksmtp/fixtures/server.key"
48+
caFile = "smtptest/fixtures/ca.crt"
49+
certFile = "smtptest/fixtures/server.crt"
50+
keyFile = "smtptest/fixtures/server.key"
5151
)
5252

5353
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true, IgnoredErrorIs: []error{}}).Leveled(slog.LevelDebug)
@@ -123,7 +123,7 @@ func TestSMTP(t *testing.T) {
123123

124124
Auth: codersdk.NotificationsEmailAuthConfig{
125125
Username: username,
126-
PasswordFile: "mocksmtp/fixtures/password.txt",
126+
PasswordFile: "smtptest/fixtures/password.txt",
127127
},
128128
},
129129
toAddrs: []string{to},
@@ -339,14 +339,14 @@ func TestSMTP(t *testing.T) {
339339
cfg: codersdk.NotificationsEmailConfig{
340340
TLS: codersdk.NotificationsEmailTLSConfig{
341341
CAFile: caFile,
342-
CertFile: "mocksmtp/fixtures/nope.cert",
342+
CertFile: "smtptest/fixtures/nope.cert",
343343
KeyFile: keyFile,
344344
},
345345
},
346346
// not using full error message here since it differs on *nix and Windows:
347347
// *nix: no such file or directory
348348
// Windows: The system cannot find the file specified.
349-
expectedErr: "open mocksmtp/fixtures/nope.cert:",
349+
expectedErr: "open smtptest/fixtures/nope.cert:",
350350
retryable: true,
351351
},
352352
{
@@ -356,13 +356,13 @@ func TestSMTP(t *testing.T) {
356356
TLS: codersdk.NotificationsEmailTLSConfig{
357357
CAFile: caFile,
358358
CertFile: certFile,
359-
KeyFile: "mocksmtp/fixtures/nope.key",
359+
KeyFile: "smtptest/fixtures/nope.key",
360360
},
361361
},
362362
// not using full error message here since it differs on *nix and Windows:
363363
// *nix: no such file or directory
364364
// Windows: The system cannot find the file specified.
365-
expectedErr: "open mocksmtp/fixtures/nope.key:",
365+
expectedErr: "open smtptest/fixtures/nope.key:",
366366
retryable: true,
367367
},
368368
/**
@@ -415,7 +415,7 @@ func TestSMTP(t *testing.T) {
415415

416416
tc.cfg.ForceTLS = serpent.Bool(tc.useTLS)
417417

418-
backend := mocksmtp.NewBackend(mocksmtp.Config{
418+
backend := smtptest.NewBackend(smtptest.Config{
419419
AuthMechanisms: tc.authMechs,
420420

421421
AcceptedIdentity: tc.cfg.Auth.Identity.String(),
@@ -426,7 +426,7 @@ func TestSMTP(t *testing.T) {
426426
})
427427

428428
// Create a mock SMTP server which conditionally listens for plain or TLS connections.
429-
srv, listen, err := mocksmtp.CreateMockSMTPServer(backend, tc.useTLS)
429+
srv, listen, err := smtptest.CreateMockSMTPServer(backend, tc.useTLS)
430430
require.NoError(t, err)
431431
t.Cleanup(func() {
432432
// We expect that the server has already been closed in the test
@@ -458,7 +458,7 @@ func TestSMTP(t *testing.T) {
458458

459459
// Wait for the server to become pingable.
460460
require.Eventually(t, func() bool {
461-
cl, err := mocksmtp.PingClient(listen, tc.useTLS, tc.cfg.TLS.StartTLS.Value())
461+
cl, err := smtptest.PingClient(listen, tc.useTLS, tc.cfg.TLS.StartTLS.Value())
462462
if err != nil {
463463
t.Logf("smtp not yet dialable: %s", err)
464464
return false

0 commit comments

Comments
 (0)