mirror of https://github.com/go-gitea/gitea
fix test
This commit is contained in:
parent
1ecb6fbc3e
commit
f06e09151d
|
@ -89,7 +89,7 @@
|
|||
commit_id: 'cb24c347e328d83c1e0c3c908a6b2c0a2fcb8a3d'
|
||||
commit_message: 'add'
|
||||
commit_time: 1689838761
|
||||
pusher_id: 1
|
||||
pusher_id: 8
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
@ -101,7 +101,7 @@
|
|||
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
|
||||
commit_message: 'Initial commit'
|
||||
commit_time: 1489927679
|
||||
pusher_id: 1
|
||||
pusher_id: 8
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
|
@ -200,4 +200,4 @@
|
|||
pusher_id: 5
|
||||
is_deleted: false
|
||||
deleted_by_id: 0
|
||||
deleted_unix: 0
|
||||
deleted_unix: 0
|
||||
|
|
|
@ -102,6 +102,18 @@
|
|||
|
||||
-
|
||||
id: 18
|
||||
uid: 4
|
||||
org_id: 23
|
||||
uid: 2
|
||||
org_id: 37
|
||||
is_public: false
|
||||
|
||||
-
|
||||
id: 19
|
||||
uid: 4
|
||||
org_id: 38
|
||||
is_public: false
|
||||
|
||||
-
|
||||
id: 20
|
||||
uid: 5
|
||||
org_id: 38
|
||||
is_public: false
|
||||
|
|
|
@ -1665,8 +1665,8 @@
|
|||
|
||||
-
|
||||
id: 58
|
||||
owner_id: 1
|
||||
owner_name: user1
|
||||
owner_id: 8
|
||||
owner_name: user8
|
||||
lower_name: user_fork_repo1
|
||||
name: user_fork_repo1
|
||||
num_watches: 0
|
||||
|
@ -1695,8 +1695,8 @@
|
|||
|
||||
-
|
||||
id: 59
|
||||
owner_id: 3
|
||||
owner_name: user3
|
||||
owner_id: 37
|
||||
owner_name: org37
|
||||
lower_name: org_fork_repo1
|
||||
name: org_fork_repo1
|
||||
num_watches: 0
|
||||
|
@ -1725,8 +1725,8 @@
|
|||
|
||||
-
|
||||
id: 60
|
||||
owner_id: 23
|
||||
owner_name: privated_org
|
||||
owner_id: 38
|
||||
owner_name: private_org38
|
||||
lower_name: private_org_fork_repo1
|
||||
name: private_org_fork_repo1
|
||||
num_watches: 0
|
||||
|
@ -1751,4 +1751,4 @@
|
|||
template_id: 0
|
||||
size: 0
|
||||
is_fsck_enabled: true
|
||||
close_issues_via_commit_in_any_branch: false
|
||||
close_issues_via_commit_in_any_branch: false
|
||||
|
|
|
@ -220,9 +220,31 @@
|
|||
|
||||
-
|
||||
id: 21
|
||||
org_id: 23
|
||||
lower_name: team21readcode
|
||||
name: team14WriteAuth
|
||||
org_id: 37
|
||||
lower_name: owners
|
||||
name: Owners
|
||||
authorize: 4 # owner
|
||||
num_repos: 0
|
||||
num_members: 1
|
||||
includes_all_repositories: false
|
||||
can_create_org_repo: true
|
||||
|
||||
-
|
||||
id: 22
|
||||
org_id: 38
|
||||
lower_name: owners
|
||||
name: Owners
|
||||
authorize: 4 # owner
|
||||
num_repos: 0
|
||||
num_members: 0
|
||||
includes_all_repositories: false
|
||||
can_create_org_repo: true
|
||||
|
||||
-
|
||||
id: 23
|
||||
org_id: 38
|
||||
lower_name: team23readcode
|
||||
name: team23readcode
|
||||
authorize: 1 # read
|
||||
num_repos: 1
|
||||
num_members: 1
|
||||
|
@ -230,12 +252,12 @@
|
|||
can_create_org_repo: true
|
||||
|
||||
-
|
||||
id: 22
|
||||
org_id: 23
|
||||
lower_name: team22noreadcode
|
||||
name: team14WriteAuth
|
||||
id: 24
|
||||
org_id: 38
|
||||
lower_name: team24noreadcode
|
||||
name: team24noreadcode
|
||||
authorize: 0 # no access
|
||||
num_repos: 1
|
||||
num_members: 1
|
||||
includes_all_repositories: false
|
||||
can_create_org_repo: true
|
||||
can_create_org_repo: true
|
||||
|
|
|
@ -66,12 +66,12 @@
|
|||
|
||||
-
|
||||
id: 12
|
||||
org_id: 23
|
||||
team_id: 21
|
||||
org_id: 38
|
||||
team_id: 23
|
||||
repo_id: 60
|
||||
|
||||
-
|
||||
id: 13
|
||||
org_id: 23
|
||||
team_id: 22
|
||||
repo_id: 60
|
||||
org_id: 38
|
||||
team_id: 24
|
||||
repo_id: 60
|
||||
|
|
|
@ -285,10 +285,16 @@
|
|||
id: 48
|
||||
team_id: 21
|
||||
type: 1 # code
|
||||
access_mode: 1
|
||||
access_mode: 4
|
||||
|
||||
-
|
||||
id: 49
|
||||
team_id: 22
|
||||
team_id: 23
|
||||
type: 1 # code
|
||||
access_mode: 0
|
||||
access_mode: 1
|
||||
|
||||
-
|
||||
id: 50
|
||||
team_id: 24
|
||||
type: 1 # code
|
||||
access_mode: 0
|
||||
|
|
|
@ -126,12 +126,18 @@
|
|||
|
||||
-
|
||||
id: 22
|
||||
org_id: 23
|
||||
org_id: 37
|
||||
team_id: 21
|
||||
uid: 4
|
||||
uid: 2
|
||||
|
||||
-
|
||||
id: 23
|
||||
org_id: 23
|
||||
team_id: 22
|
||||
uid: 5
|
||||
org_id: 38
|
||||
team_id: 23
|
||||
uid: 4
|
||||
|
||||
-
|
||||
id: 24
|
||||
org_id: 38
|
||||
team_id: 24
|
||||
uid: 5
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
num_followers: 0
|
||||
num_following: 0
|
||||
num_stars: 0
|
||||
num_repos: 1
|
||||
num_repos: 0
|
||||
num_teams: 0
|
||||
num_members: 0
|
||||
visibility: 0
|
||||
|
@ -103,7 +103,7 @@
|
|||
num_followers: 0
|
||||
num_following: 0
|
||||
num_stars: 0
|
||||
num_repos: 4
|
||||
num_repos: 3
|
||||
num_teams: 5
|
||||
num_members: 3
|
||||
visibility: 0
|
||||
|
@ -288,7 +288,7 @@
|
|||
num_followers: 1
|
||||
num_following: 1
|
||||
num_stars: 0
|
||||
num_repos: 0
|
||||
num_repos: 1
|
||||
num_teams: 0
|
||||
num_members: 0
|
||||
visibility: 0
|
||||
|
@ -843,9 +843,9 @@
|
|||
num_followers: 0
|
||||
num_following: 0
|
||||
num_stars: 0
|
||||
num_repos: 3
|
||||
num_teams: 4
|
||||
num_members: 2
|
||||
num_repos: 2
|
||||
num_teams: 2
|
||||
num_members: 1
|
||||
visibility: 2
|
||||
repo_admin_change_team_access: false
|
||||
theme: ""
|
||||
|
@ -1332,3 +1332,77 @@
|
|||
repo_admin_change_team_access: false
|
||||
theme: ""
|
||||
keep_activity_private: false
|
||||
|
||||
-
|
||||
id: 37
|
||||
lower_name: org37
|
||||
name: org37
|
||||
full_name: Org 37
|
||||
email: org37@example.com
|
||||
keep_email_private: false
|
||||
email_notifications_preference: enabled
|
||||
passwd: ZogKvWdyEx:password
|
||||
passwd_hash_algo: dummy
|
||||
must_change_password: false
|
||||
login_source: 0
|
||||
login_name: org37
|
||||
type: 1
|
||||
salt: ZogKvWdyEx
|
||||
max_repo_creation: -1
|
||||
is_active: true
|
||||
is_admin: false
|
||||
is_restricted: false
|
||||
allow_git_hook: false
|
||||
allow_import_local: false
|
||||
allow_create_organization: true
|
||||
prohibit_login: false
|
||||
avatar: avatar37
|
||||
avatar_email: org37@example.com
|
||||
use_custom_avatar: false
|
||||
num_followers: 0
|
||||
num_following: 0
|
||||
num_stars: 0
|
||||
num_repos: 1
|
||||
num_teams: 1
|
||||
num_members: 1
|
||||
visibility: 0
|
||||
repo_admin_change_team_access: false
|
||||
theme: ""
|
||||
keep_activity_private: false
|
||||
|
||||
-
|
||||
id: 38
|
||||
lower_name: private_org38
|
||||
name: private_org38
|
||||
full_name: Private Org 38
|
||||
email: private_org38@example.com
|
||||
keep_email_private: false
|
||||
email_notifications_preference: enabled
|
||||
passwd: ZogKvWdyEx:password
|
||||
passwd_hash_algo: dummy
|
||||
must_change_password: false
|
||||
login_source: 0
|
||||
login_name: private_org38
|
||||
type: 1
|
||||
salt: ZogKvWdyEx
|
||||
max_repo_creation: -1
|
||||
is_active: true
|
||||
is_admin: false
|
||||
is_restricted: false
|
||||
allow_git_hook: false
|
||||
allow_import_local: false
|
||||
allow_create_organization: true
|
||||
prohibit_login: false
|
||||
avatar: avatar38
|
||||
avatar_email: private_org38@example.com
|
||||
use_custom_avatar: false
|
||||
num_followers: 0
|
||||
num_following: 0
|
||||
num_stars: 0
|
||||
num_repos: 1
|
||||
num_teams: 3
|
||||
num_members: 2
|
||||
visibility: 2
|
||||
repo_admin_change_team_access: false
|
||||
theme: ""
|
||||
keep_activity_private: false
|
||||
|
|
|
@ -395,7 +395,7 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, from, to str
|
|||
|
||||
// FindRecentlyPushedNewBranches return at most 2 new branches pushed by the user in 6 hours which has no opened PRs created
|
||||
// doer should not be nil
|
||||
// if commitAfterUnix is 0, will find the branches commited in recently 6 hours
|
||||
// if commitAfterUnix is 0, will find the branches committed in recently 6 hours
|
||||
// TODO use options to find the branches
|
||||
func FindRecentlyPushedNewBranches(ctx context.Context, baseRepo *repo_model.Repository, doer *user_model.User, commitAfterUnix int64) (BranchList, error) {
|
||||
baseBranch, err := GetBranch(ctx, baseRepo.ID, baseRepo.DefaultBranch)
|
||||
|
|
|
@ -199,9 +199,9 @@ func TestFindRecentlyPushedNewBranches(t *testing.T) {
|
|||
assert.Equal(t, "new-commit", branches[0].Name)
|
||||
assert.Equal(t, "org-fork-new-commit", branches[1].Name)
|
||||
|
||||
// test new branch from user public and private fork repo
|
||||
user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
||||
branches, err = git_model.FindRecentlyPushedNewBranches(db.DefaultContext, repo, user1, 1689838760)
|
||||
// test new branch from user fork repo
|
||||
user8 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 8})
|
||||
branches, err = git_model.FindRecentlyPushedNewBranches(db.DefaultContext, repo, user8, 1689838760)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, len(branches))
|
||||
assert.Equal(t, "user-fork-new-commit", branches[0].Name)
|
||||
|
|
Loading…
Reference in New Issue