mirror of https://github.com/go-gitea/gitea
improve test
This commit is contained in:
parent
fb3afac3e5
commit
9a9dd060b0
|
@ -139,12 +139,12 @@
|
|||
-
|
||||
id: 24
|
||||
user_id: 40
|
||||
repo_id: 59
|
||||
repo_id: 60
|
||||
mode: 4
|
||||
|
||||
-
|
||||
id: 25
|
||||
user_id: 41
|
||||
repo_id: 60
|
||||
repo_id: 61
|
||||
mode: 1
|
||||
|
||||
|
|
|
@ -48,7 +48,19 @@
|
|||
|
||||
-
|
||||
id: 5
|
||||
repo_id: 1
|
||||
repo_id: 58
|
||||
name: 'master'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
commit_time: 1489927679
|
||||
pusher_id: 39
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 6
|
||||
repo_id: 58
|
||||
name: 'new-commit'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -59,8 +71,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 6
|
||||
repo_id: 1
|
||||
id: 7
|
||||
repo_id: 58
|
||||
name: 'no-commit'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
|
@ -71,8 +83,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 7
|
||||
repo_id: 1
|
||||
id: 8
|
||||
repo_id: 58
|
||||
name: 'opening-pr'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -83,8 +95,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 8
|
||||
repo_id: 1
|
||||
id: 9
|
||||
repo_id: 58
|
||||
name: 'closed-pr'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -95,8 +107,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 9
|
||||
repo_id: 1
|
||||
id: 10
|
||||
repo_id: 58
|
||||
name: 'merged-pr'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -107,8 +119,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 10
|
||||
repo_id: 1
|
||||
id: 11
|
||||
repo_id: 58
|
||||
name: 'closed-pr-with-deleted-branch'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -118,22 +130,10 @@
|
|||
deleted_by_id: 39
|
||||
deleted_unix: 1489927700
|
||||
|
||||
-
|
||||
id: 11
|
||||
repo_id: 1
|
||||
name: 'merged-pr-with-deleted-branch'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
commit_time: 1489927680
|
||||
pusher_id: 39
|
||||
is_deleted: true
|
||||
deleted_by_id: 39
|
||||
deleted_unix: 1489927700
|
||||
|
||||
-
|
||||
id: 12
|
||||
repo_id: 1
|
||||
name: 'deleted-branch'
|
||||
repo_id: 58
|
||||
name: 'merged-pr-with-deleted-branch'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
commit_time: 1489927680
|
||||
|
@ -145,18 +145,30 @@
|
|||
-
|
||||
id: 13
|
||||
repo_id: 58
|
||||
name: 'deleted-branch'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
commit_time: 1489927680
|
||||
pusher_id: 39
|
||||
is_deleted: true
|
||||
deleted_by_id: 39
|
||||
deleted_unix: 1489927700
|
||||
|
||||
-
|
||||
id: 14
|
||||
repo_id: 59
|
||||
name: 'master'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
commit_time: 1489927679
|
||||
pusher_id: 1
|
||||
pusher_id: 40
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 14
|
||||
repo_id: 58
|
||||
id: 15
|
||||
repo_id: 59
|
||||
name: 'user-fork-new-commit'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -167,8 +179,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 15
|
||||
repo_id: 58
|
||||
id: 16
|
||||
repo_id: 59
|
||||
name: 'user-fork-no-commit'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
|
@ -179,20 +191,20 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 16
|
||||
repo_id: 59
|
||||
id: 17
|
||||
repo_id: 60
|
||||
name: 'master'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
commit_time: 1489927679
|
||||
pusher_id: 1
|
||||
pusher_id: 39
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 17
|
||||
repo_id: 59
|
||||
id: 18
|
||||
repo_id: 60
|
||||
name: 'org-fork-new-commit'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -203,8 +215,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 18
|
||||
repo_id: 59
|
||||
id: 19
|
||||
repo_id: 60
|
||||
name: 'org-fork-no-commit'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
|
@ -215,20 +227,20 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 19
|
||||
repo_id: 60
|
||||
id: 20
|
||||
repo_id: 61
|
||||
name: 'master'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
commit_time: 1489927679
|
||||
pusher_id: 1
|
||||
pusher_id: 41
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 20
|
||||
repo_id: 60
|
||||
id: 21
|
||||
repo_id: 61
|
||||
name: 'private-org-fork-new-commit'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -239,8 +251,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 21
|
||||
repo_id: 60
|
||||
id: 22
|
||||
repo_id: 61
|
||||
name: 'private-org-fork-no-commit'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
|
@ -251,8 +263,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 22
|
||||
repo_id: 60
|
||||
id: 23
|
||||
repo_id: 61
|
||||
name: 'private-org-fork-no-permission-new-commit'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
|
@ -263,8 +275,8 @@
|
|||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 23
|
||||
repo_id: 60
|
||||
id: 24
|
||||
repo_id: 61
|
||||
name: 'private-org-fork-no-permission-no-commit'
|
||||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
|
@ -274,18 +286,6 @@
|
|||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 24
|
||||
repo_id: 1
|
||||
name: 'same-name-branch-in-pr'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
commit_time: 1489927680
|
||||
pusher_id: 40
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 25
|
||||
repo_id: 58
|
||||
|
@ -297,3 +297,15 @@
|
|||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
||||
-
|
||||
id: 26
|
||||
repo_id: 59
|
||||
name: 'same-name-branch-in-pr'
|
||||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
commit_time: 1489927680
|
||||
pusher_id: 40
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
|
|
@ -307,8 +307,8 @@
|
|||
|
||||
-
|
||||
id: 19
|
||||
repo_id: 1
|
||||
index: 6
|
||||
repo_id: 58
|
||||
index: 1
|
||||
poster_id: 39
|
||||
original_author_id: 0
|
||||
name: opening pr for recently new branch search test
|
||||
|
@ -324,8 +324,8 @@
|
|||
|
||||
-
|
||||
id: 20
|
||||
repo_id: 1
|
||||
index: 7
|
||||
repo_id: 58
|
||||
index: 2
|
||||
poster_id: 39
|
||||
original_author_id: 0
|
||||
name: closed pr for recently new branch search test
|
||||
|
@ -341,8 +341,8 @@
|
|||
|
||||
-
|
||||
id: 21
|
||||
repo_id: 1
|
||||
index: 8
|
||||
repo_id: 58
|
||||
index: 3
|
||||
poster_id: 39
|
||||
original_author_id: 0
|
||||
name: merged pr for recently new branch search test
|
||||
|
@ -358,8 +358,8 @@
|
|||
|
||||
-
|
||||
id: 22
|
||||
repo_id: 1
|
||||
index: 9
|
||||
repo_id: 58
|
||||
index: 4
|
||||
poster_id: 39
|
||||
original_author_id: 0
|
||||
name: closed pr with deleted branch for recently new branch search test
|
||||
|
@ -375,8 +375,8 @@
|
|||
|
||||
-
|
||||
id: 23
|
||||
repo_id: 1
|
||||
index: 10
|
||||
repo_id: 58
|
||||
index: 5
|
||||
poster_id: 39
|
||||
original_author_id: 0
|
||||
name: merged pr with deleted branch for recently new branch search test
|
||||
|
@ -392,7 +392,7 @@
|
|||
|
||||
-
|
||||
id: 24
|
||||
repo_id: 58
|
||||
repo_id: 59
|
||||
index: 1
|
||||
poster_id: 40
|
||||
original_author_id: 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-
|
||||
group_id: 1
|
||||
max_index: 10
|
||||
max_index: 5
|
||||
|
||||
-
|
||||
group_id: 2
|
||||
|
@ -36,4 +36,8 @@
|
|||
|
||||
-
|
||||
group_id: 58
|
||||
max_index: 5
|
||||
|
||||
-
|
||||
group_id: 59
|
||||
max_index: 1
|
||||
|
|
|
@ -82,9 +82,9 @@
|
|||
type: 0 # gitea pull request
|
||||
status: 2 # mergable
|
||||
issue_id: 19
|
||||
index: 4
|
||||
head_repo_id: 1
|
||||
base_repo_id: 1
|
||||
index: 1
|
||||
head_repo_id: 58
|
||||
base_repo_id: 58
|
||||
head_branch: opening-pr
|
||||
base_branch: master
|
||||
merge_base: cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d
|
||||
|
@ -95,9 +95,9 @@
|
|||
type: 0 # gitea pull request
|
||||
status: 2 # mergable
|
||||
issue_id: 20
|
||||
index: 5
|
||||
head_repo_id: 1
|
||||
base_repo_id: 1
|
||||
index: 2
|
||||
head_repo_id: 58
|
||||
base_repo_id: 58
|
||||
head_branch: closed-pr
|
||||
base_branch: master
|
||||
merge_base: cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d
|
||||
|
@ -108,9 +108,9 @@
|
|||
type: 0 # gitea pull request
|
||||
status: 3 # manually merged
|
||||
issue_id: 21
|
||||
index: 6
|
||||
head_repo_id: 1
|
||||
base_repo_id: 1
|
||||
index: 3
|
||||
head_repo_id: 58
|
||||
base_repo_id: 58
|
||||
head_branch: merged-pr
|
||||
base_branch: master
|
||||
merge_base: cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d
|
||||
|
@ -121,9 +121,9 @@
|
|||
type: 0 # gitea pull request
|
||||
status: 2 # mergable
|
||||
issue_id: 22
|
||||
index: 7
|
||||
head_repo_id: 1
|
||||
base_repo_id: 1
|
||||
index: 4
|
||||
head_repo_id: 58
|
||||
base_repo_id: 58
|
||||
head_branch: closed-pr-with-deleted-branch
|
||||
base_branch: master
|
||||
merge_base: cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d
|
||||
|
@ -134,9 +134,9 @@
|
|||
type: 0 # gitea pull request
|
||||
status: 3 # manually merged
|
||||
issue_id: 23
|
||||
index: 8
|
||||
head_repo_id: 1
|
||||
base_repo_id: 1
|
||||
index: 5
|
||||
head_repo_id: 58
|
||||
base_repo_id: 58
|
||||
head_branch: merged-pr-with-deleted-branch
|
||||
base_branch: master
|
||||
merge_base: cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d
|
||||
|
@ -148,8 +148,8 @@
|
|||
status: 2 # mergable
|
||||
issue_id: 24
|
||||
index: 1
|
||||
head_repo_id: 58
|
||||
base_repo_id: 1
|
||||
head_repo_id: 59
|
||||
base_repo_id: 58
|
||||
head_branch: same-name-branch-in-pr
|
||||
base_branch: master
|
||||
merge_base: cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d
|
||||
|
|
|
@ -610,12 +610,12 @@
|
|||
|
||||
-
|
||||
id: 91
|
||||
repo_id: 59
|
||||
repo_id: 60
|
||||
type: 1
|
||||
created_unix: 946684810
|
||||
|
||||
-
|
||||
id: 92
|
||||
repo_id: 60
|
||||
repo_id: 61
|
||||
type: 1
|
||||
created_unix: 946684810
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
default_branch: master
|
||||
num_watches: 4
|
||||
num_stars: 0
|
||||
num_forks: 3
|
||||
num_forks: 0
|
||||
num_issues: 2
|
||||
num_closed_issues: 1
|
||||
num_pulls: 8
|
||||
num_closed_pulls: 2
|
||||
num_pulls: 3
|
||||
num_closed_pulls: 0
|
||||
num_milestones: 3
|
||||
num_closed_milestones: 1
|
||||
num_projects: 1
|
||||
|
@ -1665,6 +1665,37 @@
|
|||
|
||||
-
|
||||
id: 58
|
||||
owner_id: 2
|
||||
owner_name: user2
|
||||
lower_name: repo58
|
||||
name: repo58
|
||||
default_branch: master
|
||||
num_watches: 0
|
||||
num_stars: 0
|
||||
num_forks: 3
|
||||
num_issues: 0
|
||||
num_closed_issues: 0
|
||||
num_pulls: 5
|
||||
num_closed_pulls: 2
|
||||
num_milestones: 0
|
||||
num_closed_milestones: 0
|
||||
num_projects: 0
|
||||
num_closed_projects: 0
|
||||
is_private: true
|
||||
is_empty: false
|
||||
is_archived: false
|
||||
is_mirror: false
|
||||
status: 0
|
||||
is_fork: false
|
||||
fork_id: 0
|
||||
is_template: false
|
||||
template_id: 0
|
||||
size: 0
|
||||
is_fsck_enabled: true
|
||||
close_issues_via_commit_in_any_branch: false
|
||||
|
||||
-
|
||||
id: 59
|
||||
owner_id: 40
|
||||
owner_name: user40
|
||||
lower_name: user_fork_repo
|
||||
|
@ -1686,7 +1717,7 @@
|
|||
is_mirror: false
|
||||
status: 0
|
||||
is_fork: true
|
||||
fork_id: 1
|
||||
fork_id: 58
|
||||
is_template: false
|
||||
template_id: 0
|
||||
size: 0
|
||||
|
@ -1694,7 +1725,7 @@
|
|||
close_issues_via_commit_in_any_branch: false
|
||||
|
||||
-
|
||||
id: 59
|
||||
id: 60
|
||||
owner_id: 37
|
||||
owner_name: org37
|
||||
lower_name: org_fork_repo1
|
||||
|
@ -1716,7 +1747,7 @@
|
|||
is_mirror: false
|
||||
status: 0
|
||||
is_fork: true
|
||||
fork_id: 1
|
||||
fork_id: 58
|
||||
is_template: false
|
||||
template_id: 0
|
||||
size: 0
|
||||
|
@ -1724,7 +1755,7 @@
|
|||
close_issues_via_commit_in_any_branch: false
|
||||
|
||||
-
|
||||
id: 60
|
||||
id: 61
|
||||
owner_id: 38
|
||||
owner_name: private_org38
|
||||
lower_name: private_org_fork_repo1
|
||||
|
@ -1746,7 +1777,7 @@
|
|||
is_mirror: false
|
||||
status: 0
|
||||
is_fork: true
|
||||
fork_id: 1
|
||||
fork_id: 58
|
||||
is_template: false
|
||||
template_id: 0
|
||||
size: 0
|
||||
|
|
|
@ -68,10 +68,10 @@
|
|||
id: 12
|
||||
org_id: 38
|
||||
team_id: 23
|
||||
repo_id: 60
|
||||
repo_id: 61
|
||||
|
||||
-
|
||||
id: 13
|
||||
org_id: 38
|
||||
team_id: 24
|
||||
repo_id: 60
|
||||
repo_id: 61
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
num_followers: 2
|
||||
num_following: 1
|
||||
num_stars: 2
|
||||
num_repos: 13
|
||||
num_repos: 14
|
||||
num_teams: 0
|
||||
num_members: 0
|
||||
visibility: 0
|
||||
|
|
|
@ -188,7 +188,7 @@ func TestOnlyGetDeletedBranchOnCorrectRepo(t *testing.T) {
|
|||
func TestFindRecentlyPushedNewBranches(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 58})
|
||||
user39 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 39})
|
||||
user40 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 40})
|
||||
user41 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 41})
|
||||
|
@ -213,11 +213,11 @@ func TestFindRecentlyPushedNewBranches(t *testing.T) {
|
|||
},
|
||||
},
|
||||
count: 2,
|
||||
want: []int64{5, 17}, // "new-commit", "org-fork-new-commit"
|
||||
want: []int64{6, 18}, // "new-commit", "org-fork-new-commit"
|
||||
},
|
||||
// we have 2 branches with the same name in repo1 and repo58
|
||||
// and repo58's branch has a pr, but repo1's branch doesn't
|
||||
// in this case, we should get repo1's branch but not repo58's branch
|
||||
// we have 2 branches with the same name in repo58 and repo59
|
||||
// and repo59's branch has a pr, but repo58's branch doesn't
|
||||
// in this case, we should get repo58's branch but not repo59's branch
|
||||
{
|
||||
name: "new branch from user fork repo and same name branch",
|
||||
opts: &git_model.FindRecentlyPushedNewBranchesOptions{
|
||||
|
@ -229,7 +229,7 @@ func TestFindRecentlyPushedNewBranches(t *testing.T) {
|
|||
},
|
||||
},
|
||||
count: 2,
|
||||
want: []int64{14, 24}, // "user-fork-new-commit", "same-name-branch-in-pr"
|
||||
want: []int64{15, 25}, // "user-fork-new-commit", "same-name-branch-in-pr"
|
||||
},
|
||||
{
|
||||
name: "new branch from private org with code permisstion repo",
|
||||
|
@ -238,7 +238,7 @@ func TestFindRecentlyPushedNewBranches(t *testing.T) {
|
|||
CommitAfterUnix: 1489927670,
|
||||
},
|
||||
count: 1,
|
||||
want: []int64{20}, // "private-org-fork-new-commit"
|
||||
want: []int64{21}, // "private-org-fork-new-commit"
|
||||
},
|
||||
{
|
||||
name: "new branch from private org with no code permisstion repo",
|
||||
|
@ -256,7 +256,7 @@ func TestFindRecentlyPushedNewBranches(t *testing.T) {
|
|||
CommitAfterUnix: 1489927690,
|
||||
},
|
||||
count: 1,
|
||||
want: []int64{17}, // "org-fork-new-commit"
|
||||
want: []int64{18}, // "org-fork-new-commit"
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -538,7 +538,7 @@ func TestCountIssues(t *testing.T) {
|
|||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
count, err := issues_model.CountIssues(db.DefaultContext, &issues_model.IssuesOptions{})
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 18, count)
|
||||
assert.EqualValues(t, 24, count)
|
||||
}
|
||||
|
||||
func TestIssueLoadAttributes(t *testing.T) {
|
||||
|
|
|
@ -75,7 +75,7 @@ func TestPulls(t *testing.T) {
|
|||
Pulls(ctx)
|
||||
assert.EqualValues(t, http.StatusOK, ctx.Resp.Status())
|
||||
|
||||
assert.Len(t, ctx.Data["Issues"], 4)
|
||||
assert.Len(t, ctx.Data["Issues"], 7)
|
||||
}
|
||||
|
||||
func TestMilestones(t *testing.T) {
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestGetRefEndNamesAndURLs(t *testing.T) {
|
|||
func TestIssue_DeleteIssue(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
issueCount := 10
|
||||
issueCount := 5
|
||||
issueIDs, err := issues_model.GetIssueIDsByRepoID(db.DefaultContext, 1)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, issueIDs, issueCount)
|
||||
|
|
|
@ -219,7 +219,7 @@ func TestAPISearchIssues(t *testing.T) {
|
|||
token := getUserToken(t, "user2", auth_model.AccessTokenScopeReadIssue)
|
||||
|
||||
// as this API was used in the frontend, it uses UI page size
|
||||
expectedIssueCount := 16 // from the fixtures
|
||||
expectedIssueCount := 20 // from the fixtures
|
||||
if expectedIssueCount > setting.UI.IssuePagingNum {
|
||||
expectedIssueCount = setting.UI.IssuePagingNum
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ func TestAPISearchIssues(t *testing.T) {
|
|||
req = NewRequest(t, "GET", link.String())
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &apiIssues)
|
||||
assert.Len(t, apiIssues, 9)
|
||||
assert.Len(t, apiIssues, 13)
|
||||
query.Del("since")
|
||||
query.Del("before")
|
||||
|
||||
|
@ -252,22 +252,22 @@ func TestAPISearchIssues(t *testing.T) {
|
|||
req = NewRequest(t, "GET", link.String())
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &apiIssues)
|
||||
assert.Len(t, apiIssues, 2)
|
||||
assert.Len(t, apiIssues, 4)
|
||||
|
||||
query.Set("state", "all")
|
||||
link.RawQuery = query.Encode()
|
||||
req = NewRequest(t, "GET", link.String())
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &apiIssues)
|
||||
assert.EqualValues(t, "18", resp.Header().Get("X-Total-Count"))
|
||||
assert.Len(t, apiIssues, 18)
|
||||
assert.EqualValues(t, "24", resp.Header().Get("X-Total-Count"))
|
||||
assert.Len(t, apiIssues, 20)
|
||||
|
||||
query.Add("limit", "10")
|
||||
link.RawQuery = query.Encode()
|
||||
req = NewRequest(t, "GET", link.String())
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &apiIssues)
|
||||
assert.EqualValues(t, "18", resp.Header().Get("X-Total-Count"))
|
||||
assert.EqualValues(t, "24", resp.Header().Get("X-Total-Count"))
|
||||
assert.Len(t, apiIssues, 10)
|
||||
|
||||
query = url.Values{"assigned": {"true"}, "state": {"all"}, "token": {token}}
|
||||
|
@ -296,7 +296,7 @@ func TestAPISearchIssues(t *testing.T) {
|
|||
req = NewRequest(t, "GET", link.String())
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &apiIssues)
|
||||
assert.Len(t, apiIssues, 7)
|
||||
assert.Len(t, apiIssues, 10)
|
||||
|
||||
query = url.Values{"owner": {"user3"}, "token": {token}} // organization
|
||||
link.RawQuery = query.Encode()
|
||||
|
@ -317,7 +317,7 @@ func TestAPISearchIssuesWithLabels(t *testing.T) {
|
|||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
// as this API was used in the frontend, it uses UI page size
|
||||
expectedIssueCount := 16 // from the fixtures
|
||||
expectedIssueCount := 21 // from the fixtures
|
||||
if expectedIssueCount > setting.UI.IssuePagingNum {
|
||||
expectedIssueCount = setting.UI.IssuePagingNum
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ func TestNodeinfo(t *testing.T) {
|
|||
assert.True(t, nodeinfo.OpenRegistrations)
|
||||
assert.Equal(t, "gitea", nodeinfo.Software.Name)
|
||||
assert.Equal(t, 29, nodeinfo.Usage.Users.Total)
|
||||
assert.Equal(t, 18, nodeinfo.Usage.LocalPosts)
|
||||
assert.Equal(t, 24, nodeinfo.Usage.LocalPosts)
|
||||
assert.Equal(t, 2, nodeinfo.Usage.LocalComments)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -450,7 +450,7 @@ func TestSearchIssues(t *testing.T) {
|
|||
func TestSearchIssuesWithLabels(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
expectedIssueCount := 16 // from the fixtures
|
||||
expectedIssueCount := 20 // from the fixtures
|
||||
if expectedIssueCount > setting.UI.IssuePagingNum {
|
||||
expectedIssueCount = setting.UI.IssuePagingNum
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue