File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 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}
You can’t perform that action at this time.
0 commit comments