test: backport from #9906 test data

Required for backport of v15 security fixes w/ test automation, this is
a partial cherry-pick of 5589182c54.

Signed-off-by: Nils Philippsen <nils@redhat.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9906
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Robert Wolff <mahlzahn@posteo.de>
Co-authored-by: Nils Philippsen <nilsph@noreply.codeberg.org>
Co-committed-by: Nils Philippsen <nilsph@noreply.codeberg.org>
This commit is contained in:
Nils Philippsen 2026-02-16 05:52:47 +01:00 committed by Mathieu Fenniak
parent 1c190a8701
commit 9fca6dd456
2 changed files with 21 additions and 9 deletions

View file

@ -42,7 +42,7 @@
is_closed: false is_closed: false
creator_id: 2 creator_id: 2
board_type: 1 board_type: 1
type: 2 type: 1
created_unix: 1688973000 created_unix: 1688973000
updated_unix: 1688973000 updated_unix: 1688973000
@ -54,7 +54,7 @@
is_closed: false is_closed: false
creator_id: 2 creator_id: 2
board_type: 1 board_type: 1
type: 2 type: 1
created_unix: 1688973000 created_unix: 1688973000
updated_unix: 1688973000 updated_unix: 1688973000
@ -66,6 +66,18 @@
is_closed: false is_closed: false
creator_id: 2 creator_id: 2
board_type: 1 board_type: 1
type: 2 type: 1
created_unix: 1688973000
updated_unix: 1688973000
-
id: 7
title: project on org3
owner_id: 3
repo_id: 0
is_closed: false
creator_id: 2
board_type: 1
type: 1
created_unix: 1688973000 created_unix: 1688973000
updated_unix: 1688973000 updated_unix: 1688973000

View file

@ -93,19 +93,19 @@ func TestProjectsSort(t *testing.T) {
}{ }{
{ {
sortType: "default", sortType: "default",
wants: []int64{1, 3, 2, 6, 5, 4}, wants: []int64{1, 3, 2, 7, 6, 5, 4},
}, },
{ {
sortType: "oldest", sortType: "oldest",
wants: []int64{4, 5, 6, 2, 3, 1}, wants: []int64{4, 5, 6, 7, 2, 3, 1},
}, },
{ {
sortType: "recentupdate", sortType: "recentupdate",
wants: []int64{1, 3, 2, 6, 5, 4}, wants: []int64{1, 3, 2, 7, 6, 5, 4},
}, },
{ {
sortType: "leastupdate", sortType: "leastupdate",
wants: []int64{4, 5, 6, 2, 3, 1}, wants: []int64{4, 5, 6, 7, 2, 3, 1},
}, },
} }
@ -114,8 +114,8 @@ func TestProjectsSort(t *testing.T) {
OrderBy: GetSearchOrderByBySortType(tt.sortType), OrderBy: GetSearchOrderByBySortType(tt.sortType),
}) })
require.NoError(t, err) require.NoError(t, err)
assert.EqualValues(t, int64(6), count) assert.EqualValues(t, int64(7), count)
if assert.Len(t, projects, 6) { if assert.Len(t, projects, 7) {
for i := range projects { for i := range projects {
assert.EqualValues(t, tt.wants[i], projects[i].ID) assert.EqualValues(t, tt.wants[i], projects[i].ID)
} }