mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 04:43:59 +01:00
test: check hook_task deletion
move test to integration to ensure Sqlite + MySQL testing
This commit is contained in:
parent
7c5a755602
commit
bb165fadf6
2 changed files with 25 additions and 1 deletions
|
@ -35,3 +35,9 @@
|
|||
"X-Head": "42"
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
id: 4
|
||||
hook_id: 3
|
||||
uuid: uuid4
|
||||
is_delivered: false
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package repository_test
|
||||
package integration
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
@ -11,6 +11,7 @@ import (
|
|||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
webhook_model "code.gitea.io/gitea/models/webhook"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -51,5 +52,22 @@ func TestDeleteOwnerRepositoriesDirectly(t *testing.T) {
|
|||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
||||
deletedHookID := unittest.AssertExistsAndLoadBean(t, &webhook_model.Webhook{RepoID: 1}).ID
|
||||
unittest.AssertExistsAndLoadBean(t, &webhook_model.HookTask{
|
||||
HookID: deletedHookID,
|
||||
})
|
||||
|
||||
preservedHookID := unittest.AssertExistsAndLoadBean(t, &webhook_model.Webhook{RepoID: 3}).ID
|
||||
unittest.AssertExistsAndLoadBean(t, &webhook_model.HookTask{
|
||||
HookID: preservedHookID,
|
||||
})
|
||||
|
||||
assert.NoError(t, repo_service.DeleteOwnerRepositoriesDirectly(db.DefaultContext, user))
|
||||
|
||||
unittest.AssertNotExistsBean(t, &webhook_model.HookTask{
|
||||
HookID: deletedHookID,
|
||||
})
|
||||
unittest.AssertExistsAndLoadBean(t, &webhook_model.HookTask{
|
||||
HookID: preservedHookID,
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue