Skip to content

Commit 4dfc9b6

Browse files
committed
add test
1 parent 08b15e5 commit 4dfc9b6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/integration/repo_activity_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import (
99
"strings"
1010
"testing"
1111

12+
"code.gitea.io/gitea/models/db"
1213
repo_model "code.gitea.io/gitea/models/repo"
14+
"code.gitea.io/gitea/models/unittest"
1315
"code.gitea.io/gitea/modules/test"
1416

1517
"github.com/stretchr/testify/assert"
@@ -61,5 +63,14 @@ func TestRepoActivity(t *testing.T) {
6163
// Should be 3 new issues
6264
list = htmlDoc.doc.Find("#new-issues").Next().Find("p.desc")
6365
assert.Len(t, list.Nodes, 3)
66+
67+
// Non-existing default branch
68+
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: "repo1"})
69+
repo1.DefaultBranch = "no-such-branch"
70+
_, _ = db.GetEngine(t.Context()).Cols("default_branch").Update(repo1)
71+
req = NewRequest(t, "GET", "/user2/repo1/activity")
72+
req.Header.Add("Accept", "text/html")
73+
resp = session.MakeRequest(t, req, http.StatusNotFound)
74+
assert.Contains(t, resp.Body.String(), `Default branch "no-such-branch" does not exist.`)
6475
})
6576
}

0 commit comments

Comments
 (0)