Пример #1
0
func init() {
	conf = readConfigs(NewAssetBin(""))
	config := "$RTFBLOG_DB_TEST_URL"
	envVar := os.ExpandEnv(config)
	if envVar == "" {
		return
	}
	if !strings.HasPrefix(envVar, "host=/tmp/PGSQL-") {
		return
	}
	conf.Server.DBConn = config
	logger = bark.CreateFile("tests.log")
	realDB = InitDB(getDBConnString(), bindir())
}
Пример #2
0
func init() {
	assets := NewAssetBin(buildRoot)
	conf = readConfigs(assets)
	conf.Server.StaticDir = "static"
	InitL10n(assets, "en-US")
	logger = bark.CreateFile("tests.log")
	forgeTestUser("testuser", "testpasswd")
	for i := 1; i <= 11; i++ {
		testPosts = append(testPosts, mkTestEntry(i, false))
	}
	for i := 1; i <= 2; i++ {
		testPosts = append(testPosts, mkTestEntry(i+1000, true))
	}
	langDetector = TestLangDetector{}
	cryptoHelper = TestCryptoHelper{}
	testData = TestData{}
	htmltest.Init(initRoutes(&globalContext{
		Router: pat.New(),
		Db:     &testData,
		assets: assets,
		Store:  sessions.NewCookieStore([]byte("aaabbbcccddd")),
	}))
}