diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-07-10 19:37:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-10 11:37:16 +0000 |
commit | 72b6bc8cafe1d64ff30481170cd68b85a710c67e (patch) | |
tree | 1156e8b92053cb588863ee1ea05db3e804a0831f /models/activities | |
parent | 4ea2a6de81ab6adde436d77e2743095fafa6a7a9 (diff) | |
download | gitea-72b6bc8cafe1d64ff30481170cd68b85a710c67e.tar.gz gitea-72b6bc8cafe1d64ff30481170cd68b85a710c67e.zip |
Refactor webhook (#31587)
A more complete fix for #31588
1. Make "generic" code more readable
2. Clarify HTML or Markdown for the payload content
Diffstat (limited to 'models/activities')
-rw-r--r-- | models/activities/action_test.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/models/activities/action_test.go b/models/activities/action_test.go index 557415dcda..36a38c7863 100644 --- a/models/activities/action_test.go +++ b/models/activities/action_test.go @@ -15,6 +15,7 @@ import ( "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/test" "github.com/stretchr/testify/assert" ) @@ -33,7 +34,8 @@ func TestAction_GetRepoLink(t *testing.T) { owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}) comment := unittest.AssertExistsAndLoadBean(t, &issue_model.Comment{ID: 2}) action := &activities_model.Action{RepoID: repo.ID, CommentID: comment.ID} - setting.AppSubURL = "/suburl" + defer test.MockVariableValue(&setting.AppURL, "https://try.gitea.io/suburl/")() + defer test.MockVariableValue(&setting.AppSubURL, "/suburl")() expected := path.Join(setting.AppSubURL, owner.Name, repo.Name) assert.Equal(t, expected, action.GetRepoLink(db.DefaultContext)) assert.Equal(t, repo.HTMLURL(), action.GetRepoAbsoluteLink(db.DefaultContext)) |