Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package httpapi
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestInviteMailResult(t *testing.T) {
|
||||
t.Parallel()
|
||||
cases := []struct {
|
||||
name string
|
||||
smtpEnabled bool
|
||||
sendOK bool
|
||||
wantMailSent bool
|
||||
wantToken bool
|
||||
}{
|
||||
{name: "smtp_ok", smtpEnabled: true, sendOK: true, wantMailSent: true, wantToken: false},
|
||||
{name: "smtp_send_fail", smtpEnabled: true, sendOK: false, wantMailSent: false, wantToken: true},
|
||||
{name: "noop_mailer_send_ok", smtpEnabled: false, sendOK: true, wantMailSent: false, wantToken: true},
|
||||
{name: "disabled_no_send", smtpEnabled: false, sendOK: false, wantMailSent: false, wantToken: true},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
mailSent, includeToken := inviteMailResult(tc.smtpEnabled, tc.sendOK)
|
||||
if mailSent != tc.wantMailSent {
|
||||
t.Fatalf("mailSent=%v want %v", mailSent, tc.wantMailSent)
|
||||
}
|
||||
if includeToken != tc.wantToken {
|
||||
t.Fatalf("includeToken=%v want %v", includeToken, tc.wantToken)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user