aboutsummaryrefslogtreecommitdiffstats
path: root/services/webhook/webhook_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/webhook/webhook_test.go')
-rw-r--r--services/webhook/webhook_test.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/services/webhook/webhook_test.go b/services/webhook/webhook_test.go
index 276d1e78cd..0a649d36ae 100644
--- a/services/webhook/webhook_test.go
+++ b/services/webhook/webhook_test.go
@@ -8,7 +8,6 @@ import (
"testing"
"code.gitea.io/gitea/models"
- "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
webhook_model "code.gitea.io/gitea/models/webhook"
api "code.gitea.io/gitea/modules/structs"
@@ -30,50 +29,50 @@ func TestWebhook_GetSlackHook(t *testing.T) {
func TestPrepareWebhooks(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- repo := db.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
+ repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
hookTasks := []*webhook_model.HookTask{
{RepoID: repo.ID, HookID: 1, EventType: webhook_model.HookEventPush},
}
for _, hookTask := range hookTasks {
- db.AssertNotExistsBean(t, hookTask)
+ unittest.AssertNotExistsBean(t, hookTask)
}
assert.NoError(t, PrepareWebhooks(repo, webhook_model.HookEventPush, &api.PushPayload{Commits: []*api.PayloadCommit{{}}}))
for _, hookTask := range hookTasks {
- db.AssertExistsAndLoadBean(t, hookTask)
+ unittest.AssertExistsAndLoadBean(t, hookTask)
}
}
func TestPrepareWebhooksBranchFilterMatch(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- repo := db.AssertExistsAndLoadBean(t, &models.Repository{ID: 2}).(*models.Repository)
+ repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 2}).(*models.Repository)
hookTasks := []*webhook_model.HookTask{
{RepoID: repo.ID, HookID: 4, EventType: webhook_model.HookEventPush},
}
for _, hookTask := range hookTasks {
- db.AssertNotExistsBean(t, hookTask)
+ unittest.AssertNotExistsBean(t, hookTask)
}
// this test also ensures that * doesn't handle / in any special way (like shell would)
assert.NoError(t, PrepareWebhooks(repo, webhook_model.HookEventPush, &api.PushPayload{Ref: "refs/heads/feature/7791", Commits: []*api.PayloadCommit{{}}}))
for _, hookTask := range hookTasks {
- db.AssertExistsAndLoadBean(t, hookTask)
+ unittest.AssertExistsAndLoadBean(t, hookTask)
}
}
func TestPrepareWebhooksBranchFilterNoMatch(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- repo := db.AssertExistsAndLoadBean(t, &models.Repository{ID: 2}).(*models.Repository)
+ repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 2}).(*models.Repository)
hookTasks := []*webhook_model.HookTask{
{RepoID: repo.ID, HookID: 4, EventType: webhook_model.HookEventPush},
}
for _, hookTask := range hookTasks {
- db.AssertNotExistsBean(t, hookTask)
+ unittest.AssertNotExistsBean(t, hookTask)
}
assert.NoError(t, PrepareWebhooks(repo, webhook_model.HookEventPush, &api.PushPayload{Ref: "refs/heads/fix_weird_bug"}))
for _, hookTask := range hookTasks {
- db.AssertNotExistsBean(t, hookTask)
+ unittest.AssertNotExistsBean(t, hookTask)
}
}