mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-18 16:03:07 +00:00
Backport #27103 by @JakobDev Part of #27065 Co-authored-by: JakobDev <jakobdev@gmx.de> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
parent
597b04fe2f
commit
fc7d3f7315
109 changed files with 353 additions and 306 deletions
|
@ -55,14 +55,14 @@ func TestCountNotices(t *testing.T) {
|
|||
func TestNotices(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
notices, err := system.Notices(1, 2)
|
||||
notices, err := system.Notices(db.DefaultContext, 1, 2)
|
||||
assert.NoError(t, err)
|
||||
if assert.Len(t, notices, 2) {
|
||||
assert.Equal(t, int64(3), notices[0].ID)
|
||||
assert.Equal(t, int64(2), notices[1].ID)
|
||||
}
|
||||
|
||||
notices, err = system.Notices(2, 2)
|
||||
notices, err = system.Notices(db.DefaultContext, 2, 2)
|
||||
assert.NoError(t, err)
|
||||
if assert.Len(t, notices, 1) {
|
||||
assert.Equal(t, int64(1), notices[0].ID)
|
||||
|
@ -73,7 +73,7 @@ func TestDeleteNotice(t *testing.T) {
|
|||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 3})
|
||||
assert.NoError(t, system.DeleteNotice(3))
|
||||
assert.NoError(t, system.DeleteNotice(db.DefaultContext, 3))
|
||||
unittest.AssertNotExistsBean(t, &system.Notice{ID: 3})
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ func TestDeleteNotices(t *testing.T) {
|
|||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 1})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 2})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 3})
|
||||
assert.NoError(t, system.DeleteNotices(1, 2))
|
||||
assert.NoError(t, system.DeleteNotices(db.DefaultContext, 1, 2))
|
||||
unittest.AssertNotExistsBean(t, &system.Notice{ID: 1})
|
||||
unittest.AssertNotExistsBean(t, &system.Notice{ID: 2})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 3})
|
||||
|
@ -97,7 +97,7 @@ func TestDeleteNotices2(t *testing.T) {
|
|||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 1})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 2})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 3})
|
||||
assert.NoError(t, system.DeleteNotices(3, 2))
|
||||
assert.NoError(t, system.DeleteNotices(db.DefaultContext, 3, 2))
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 1})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 2})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 3})
|
||||
|
@ -109,7 +109,7 @@ func TestDeleteNoticesByIDs(t *testing.T) {
|
|||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 1})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 2})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 3})
|
||||
assert.NoError(t, system.DeleteNoticesByIDs([]int64{1, 3}))
|
||||
assert.NoError(t, system.DeleteNoticesByIDs(db.DefaultContext, []int64{1, 3}))
|
||||
unittest.AssertNotExistsBean(t, &system.Notice{ID: 1})
|
||||
unittest.AssertExistsAndLoadBean(t, &system.Notice{ID: 2})
|
||||
unittest.AssertNotExistsBean(t, &system.Notice{ID: 3})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue