@@ -9,11 +9,15 @@ import (
9
9
"code.gitea.io/gitea/models/db"
10
10
repo_model "code.gitea.io/gitea/models/repo"
11
11
"code.gitea.io/gitea/models/unittest"
12
+ user_model "code.gitea.io/gitea/models/user"
12
13
webhook_model "code.gitea.io/gitea/models/webhook"
14
+ "code.gitea.io/gitea/modules/setting"
13
15
api "code.gitea.io/gitea/modules/structs"
14
16
webhook_module "code.gitea.io/gitea/modules/webhook"
17
+ "code.gitea.io/gitea/services/convert"
15
18
16
19
"github.com/stretchr/testify/assert"
20
+ "github.com/stretchr/testify/require"
17
21
)
18
22
19
23
func TestWebhook_GetSlackHook (t * testing.T ) {
@@ -77,3 +81,11 @@ func TestPrepareWebhooksBranchFilterNoMatch(t *testing.T) {
77
81
unittest .AssertNotExistsBean (t , hookTask )
78
82
}
79
83
}
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