forked from forgejo/forgejo
Refactor AssertExistsAndLoadBean to use generics (#20797)
* Refactor AssertExistsAndLoadBean to use generics * Fix tests Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
e3308a092a
commit
86c85c19b6
159 changed files with 888 additions and 888 deletions
|
@ -31,14 +31,14 @@ func TestIsValidHookContentType(t *testing.T) {
|
|||
|
||||
func TestWebhook_History(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
webhook := unittest.AssertExistsAndLoadBean(t, &Webhook{ID: 1}).(*Webhook)
|
||||
webhook := unittest.AssertExistsAndLoadBean(t, &Webhook{ID: 1})
|
||||
tasks, err := webhook.History(0)
|
||||
assert.NoError(t, err)
|
||||
if assert.Len(t, tasks, 1) {
|
||||
assert.Equal(t, int64(1), tasks[0].ID)
|
||||
}
|
||||
|
||||
webhook = unittest.AssertExistsAndLoadBean(t, &Webhook{ID: 2}).(*Webhook)
|
||||
webhook = unittest.AssertExistsAndLoadBean(t, &Webhook{ID: 2})
|
||||
tasks, err = webhook.History(0)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, tasks, 0)
|
||||
|
@ -46,7 +46,7 @@ func TestWebhook_History(t *testing.T) {
|
|||
|
||||
func TestWebhook_UpdateEvent(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
webhook := unittest.AssertExistsAndLoadBean(t, &Webhook{ID: 1}).(*Webhook)
|
||||
webhook := unittest.AssertExistsAndLoadBean(t, &Webhook{ID: 1})
|
||||
hookEvent := &HookEvent{
|
||||
PushOnly: true,
|
||||
SendEverything: false,
|
||||
|
@ -162,7 +162,7 @@ func TestGetWebhooksByOrgID(t *testing.T) {
|
|||
|
||||
func TestUpdateWebhook(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
hook := unittest.AssertExistsAndLoadBean(t, &Webhook{ID: 2}).(*Webhook)
|
||||
hook := unittest.AssertExistsAndLoadBean(t, &Webhook{ID: 2})
|
||||
hook.IsActive = true
|
||||
hook.ContentType = ContentTypeForm
|
||||
unittest.AssertNotExistsBean(t, hook)
|
||||
|
@ -220,7 +220,7 @@ func TestCreateHookTask(t *testing.T) {
|
|||
func TestUpdateHookTask(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
hook := unittest.AssertExistsAndLoadBean(t, &HookTask{ID: 1}).(*HookTask)
|
||||
hook := unittest.AssertExistsAndLoadBean(t, &HookTask{ID: 1})
|
||||
hook.PayloadContent = "new payload content"
|
||||
hook.DeliveredString = "new delivered string"
|
||||
hook.IsDelivered = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue