mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-20 14:20:55 +00:00
models/webhook: address review feedback - add RepoID to hookOwner3, use HookRepo1Inactive in delete test
Agent-Logs-Url: https://github.com/go-gitea/gitea/sessions/d187e3a5-2c68-4115-a4d1-d2bda8f54004 Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8bb79e76fa
commit
d3341cfb07
@@ -57,6 +57,7 @@ func prepareWebhookTestData(t *testing.T) *webhookTestFixtures {
|
||||
|
||||
hookOwner3 := &Webhook{
|
||||
OwnerID: 3,
|
||||
RepoID: 3,
|
||||
URL: "https://www.example.com/url3",
|
||||
ContentType: ContentTypeJSON,
|
||||
Events: `{"push_only":false,"choose_events":false,"events":{"create":false,"push":true,"pull_request":true}}`,
|
||||
@@ -272,9 +273,9 @@ func TestUpdateWebhook(t *testing.T) {
|
||||
|
||||
func TestDeleteWebhookByRepoID(t *testing.T) {
|
||||
fixture := prepareWebhookTestData(t)
|
||||
unittest.AssertExistsAndLoadBean(t, &Webhook{ID: fixture.HookRepo1.ID, RepoID: 1})
|
||||
assert.NoError(t, DeleteWebhookByRepoID(t.Context(), 1, fixture.HookRepo1.ID))
|
||||
unittest.AssertNotExistsBean(t, &Webhook{ID: fixture.HookRepo1.ID, RepoID: 1})
|
||||
unittest.AssertExistsAndLoadBean(t, &Webhook{ID: fixture.HookRepo1Inactive.ID, RepoID: 1})
|
||||
assert.NoError(t, DeleteWebhookByRepoID(t.Context(), 1, fixture.HookRepo1Inactive.ID))
|
||||
unittest.AssertNotExistsBean(t, &Webhook{ID: fixture.HookRepo1Inactive.ID, RepoID: 1})
|
||||
|
||||
err := DeleteWebhookByRepoID(t.Context(), unittest.NonexistentID, unittest.NonexistentID)
|
||||
assert.Error(t, err)
|
||||
|
||||
Reference in New Issue
Block a user