Fix tests

This commit is contained in:
Lunny Xiao 2025-01-02 22:26:40 -08:00
parent 361ca4002e
commit 2b830ee904
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
3 changed files with 25 additions and 2 deletions

View File

@ -131,3 +131,24 @@
commit_time: 1489956479
pusher_id: 1
is_deleted: false
-
id: 20
repo_id: 1
name: 'pr-to-update'
commit_id: '62fb502a7172d4453f0322a2cc85bddffa57f07a'
commit_message: 'add WoW File'
commit_time: 1579200695
pusher_id: 1
-
id: 21
repo_id: 10
name: 'develop'
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
commit_message: 'Initial commit'
commit_time: 1489927679
pusher_id: 12
is_deleted: false
deleted_by_id: 0
deleted_unix: 0

View File

@ -204,6 +204,8 @@ func ParseCompareInfo(ctx *context.Context) *common.CompareInfo {
ctx.NotFound("GetRepositoryByOwnerAndName", nil)
case errors.Is(err, util.ErrInvalidArgument):
ctx.NotFound("ParseComparePathParams", nil)
case git.IsErrNotExist(err):
ctx.NotFound("ParseComparePathParams", nil)
default:
ctx.ServerError("GetRepositoryByOwnerAndName", err)
}

View File

@ -270,7 +270,7 @@ func TestAPICreateBranchWithSyncBranches(t *testing.T) {
RepoID: 1,
})
assert.NoError(t, err)
assert.Len(t, branches, 4)
assert.Len(t, branches, 7)
// make a broke repository with no branch on database
_, err = db.DeleteByBean(db.DefaultContext, git_model.Branch{RepoID: 1})
@ -287,7 +287,7 @@ func TestAPICreateBranchWithSyncBranches(t *testing.T) {
RepoID: 1,
})
assert.NoError(t, err)
assert.Len(t, branches, 5)
assert.Len(t, branches, 8)
branches, err = db.Find[git_model.Branch](db.DefaultContext, git_model.FindBranchOptions{
RepoID: 1,