Skip to content

Commit 2b830ee

Browse files
committed
Fix tests
1 parent 361ca40 commit 2b830ee

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

models/fixtures/branch.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,24 @@
131131
commit_time: 1489956479
132132
pusher_id: 1
133133
is_deleted: false
134+
135+
-
136+
id: 20
137+
repo_id: 1
138+
name: 'pr-to-update'
139+
commit_id: '62fb502a7172d4453f0322a2cc85bddffa57f07a'
140+
commit_message: 'add WoW File'
141+
commit_time: 1579200695
142+
pusher_id: 1
143+
144+
-
145+
id: 21
146+
repo_id: 10
147+
name: 'develop'
148+
commit_id: '65f1bf27bc3bf70f64657658635e66094edbcb4d'
149+
commit_message: 'Initial commit'
150+
commit_time: 1489927679
151+
pusher_id: 12
152+
is_deleted: false
153+
deleted_by_id: 0
154+
deleted_unix: 0

routers/web/repo/compare.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ func ParseCompareInfo(ctx *context.Context) *common.CompareInfo {
204204
ctx.NotFound("GetRepositoryByOwnerAndName", nil)
205205
case errors.Is(err, util.ErrInvalidArgument):
206206
ctx.NotFound("ParseComparePathParams", nil)
207+
case git.IsErrNotExist(err):
208+
ctx.NotFound("ParseComparePathParams", nil)
207209
default:
208210
ctx.ServerError("GetRepositoryByOwnerAndName", err)
209211
}

tests/integration/api_branch_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func TestAPICreateBranchWithSyncBranches(t *testing.T) {
270270
RepoID: 1,
271271
})
272272
assert.NoError(t, err)
273-
assert.Len(t, branches, 4)
273+
assert.Len(t, branches, 7)
274274

275275
// make a broke repository with no branch on database
276276
_, err = db.DeleteByBean(db.DefaultContext, git_model.Branch{RepoID: 1})
@@ -287,7 +287,7 @@ func TestAPICreateBranchWithSyncBranches(t *testing.T) {
287287
RepoID: 1,
288288
})
289289
assert.NoError(t, err)
290-
assert.Len(t, branches, 5)
290+
assert.Len(t, branches, 8)
291291

292292
branches, err = db.Find[git_model.Branch](db.DefaultContext, git_model.FindBranchOptions{
293293
RepoID: 1,

0 commit comments

Comments
 (0)