Skip to content

Commit 13f53b9

Browse files
committed
fix
1 parent a96776b commit 13f53b9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

services/webhook/webhook_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ import (
99
"code.gitea.io/gitea/models/db"
1010
repo_model "code.gitea.io/gitea/models/repo"
1111
"code.gitea.io/gitea/models/unittest"
12+
user_model "code.gitea.io/gitea/models/user"
1213
webhook_model "code.gitea.io/gitea/models/webhook"
14+
"code.gitea.io/gitea/modules/setting"
1315
api "code.gitea.io/gitea/modules/structs"
1416
webhook_module "code.gitea.io/gitea/modules/webhook"
17+
"code.gitea.io/gitea/services/convert"
1518

1619
"github.com/stretchr/testify/assert"
20+
"github.com/stretchr/testify/require"
1721
)
1822

1923
func TestWebhook_GetSlackHook(t *testing.T) {
@@ -77,3 +81,11 @@ func TestPrepareWebhooksBranchFilterNoMatch(t *testing.T) {
7781
unittest.AssertNotExistsBean(t, hookTask)
7882
}
7983
}
84+
85+
func TestWebhookUserMail(t *testing.T) {
86+
require.NoError(t, unittest.PrepareTestDatabase())
87+
setting.Service.NoReplyAddress = "no-reply.com"
88+
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
89+
assert.Equal(t, user.GetPlaceholderEmail(), convert.ToUser(db.DefaultContext, user, nil).Email)
90+
assert.Equal(t, user.Email, convert.ToUser(db.DefaultContext, user, user).Email)
91+
}

0 commit comments

Comments
 (0)