forked from forgejo/forgejo
Move webhook type from int to string (#13664)
* Move webhook type from int to string * rename webhook_services * finish refactor * Fix merge * Ignore unnecessary ci Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
4d66ee1f74
commit
42354dfe45
30 changed files with 186 additions and 174 deletions
|
@ -185,28 +185,6 @@ func TestDeleteWebhookByOrgID(t *testing.T) {
|
|||
assert.True(t, IsErrWebhookNotExist(err))
|
||||
}
|
||||
|
||||
func TestToHookTaskType(t *testing.T) {
|
||||
assert.Equal(t, GOGS, ToHookTaskType("gogs"))
|
||||
assert.Equal(t, SLACK, ToHookTaskType("slack"))
|
||||
assert.Equal(t, GITEA, ToHookTaskType("gitea"))
|
||||
assert.Equal(t, TELEGRAM, ToHookTaskType("telegram"))
|
||||
}
|
||||
|
||||
func TestHookTaskType_Name(t *testing.T) {
|
||||
assert.Equal(t, "gogs", GOGS.Name())
|
||||
assert.Equal(t, "slack", SLACK.Name())
|
||||
assert.Equal(t, "gitea", GITEA.Name())
|
||||
assert.Equal(t, "telegram", TELEGRAM.Name())
|
||||
}
|
||||
|
||||
func TestIsValidHookTaskType(t *testing.T) {
|
||||
assert.True(t, IsValidHookTaskType("gogs"))
|
||||
assert.True(t, IsValidHookTaskType("slack"))
|
||||
assert.True(t, IsValidHookTaskType("gitea"))
|
||||
assert.True(t, IsValidHookTaskType("telegram"))
|
||||
assert.False(t, IsValidHookTaskType("invalid"))
|
||||
}
|
||||
|
||||
func TestHookTasks(t *testing.T) {
|
||||
assert.NoError(t, PrepareTestDatabase())
|
||||
hookTasks, err := HookTasks(1, 1)
|
||||
|
@ -225,7 +203,7 @@ func TestCreateHookTask(t *testing.T) {
|
|||
hookTask := &HookTask{
|
||||
RepoID: 3,
|
||||
HookID: 3,
|
||||
Type: GITEA,
|
||||
Typ: GITEA,
|
||||
URL: "http://www.example.com/unit_test",
|
||||
Payloader: &api.PushPayload{},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue