1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Unit tests for wiki routers (#3022)

This commit is contained in:
Ethan Koenig
2017-11-30 07:52:15 -08:00
committed by Lauris BH
parent 82e8486f13
commit 91f3d77ceb
9 changed files with 285 additions and 69 deletions

View File

@@ -19,8 +19,8 @@ func TestIssues(t *testing.T) {
setting.UI.IssuePagingNum = 1
assert.NoError(t, models.LoadFixtures())
ctx := test.MockContext(t)
ctx.User = models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
ctx := test.MockContext(t, "issues")
test.LoadUser(t, ctx, 2)
ctx.SetParams(":type", "issues")
ctx.Req.Form.Set("state", "closed")
Issues(ctx)

View File

@@ -5,29 +5,12 @@
package user
import (
"fmt"
"os"
"path/filepath"
"testing"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/setting"
_ "github.com/mattn/go-sqlite3" // for the test engine
)
func TestMain(m *testing.M) {
if err := models.CreateTestEngine("../../models/fixtures/"); err != nil {
fmt.Printf("Error creating test engine: %v\n", err)
os.Exit(1)
}
setting.AppURL = "https://try.gitea.io/"
setting.RunUser = "runuser"
setting.SSH.Port = 3000
setting.SSH.Domain = "try.gitea.io"
setting.RepoRootPath = filepath.Join(os.TempDir(), "repos")
setting.AppDataPath = filepath.Join(os.TempDir(), "appdata")
os.Exit(m.Run())
models.MainTest(m, filepath.Join("..", ".."))
}