|
|
@ -226,6 +226,12 @@ func TestWikiRaw(t *testing.T) { |
|
|
|
func TestDefaultWikiBranch(t *testing.T) { |
|
|
|
func TestDefaultWikiBranch(t *testing.T) { |
|
|
|
unittest.PrepareTestEnv(t) |
|
|
|
unittest.PrepareTestEnv(t) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// repo with no wiki
|
|
|
|
|
|
|
|
repoWithNoWiki := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2}) |
|
|
|
|
|
|
|
assert.False(t, repoWithNoWiki.HasWiki()) |
|
|
|
|
|
|
|
assert.NoError(t, wiki_service.ChangeDefaultWikiBranch(db.DefaultContext, repoWithNoWiki, "main")) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// repo with wiki
|
|
|
|
assert.NoError(t, repo_model.UpdateRepositoryCols(db.DefaultContext, &repo_model.Repository{ID: 1, DefaultWikiBranch: "wrong-branch"})) |
|
|
|
assert.NoError(t, repo_model.UpdateRepositoryCols(db.DefaultContext, &repo_model.Repository{ID: 1, DefaultWikiBranch: "wrong-branch"})) |
|
|
|
|
|
|
|
|
|
|
|
ctx, _ := contexttest.MockContext(t, "user2/repo1/wiki") |
|
|
|
ctx, _ := contexttest.MockContext(t, "user2/repo1/wiki") |
|
|
|