Esempio n. 1
0
func (s *DBSuite) SetUpTest(c *C) {
	s.dbapi.db.MustExec("CREATE SCHEMA public")
	err := s.dbapi.InitDB(utils.GetLocalFilePath("conf/tests"))
	if err != nil {
		c.Error(err)
	}
}
Esempio n. 2
0
func (s *DBSuite) SetUpSuite(c *C) {
	// Use s.dir to prepare some data.
	var err error

	configFile := utils.GetLocalFilePath("conf/testing.toml")
	LOG.Info("loading configuration %s ...\n", configFile)
	CONF.MustLoadFile(configFile)

	dialect := CONF.GetString("database.dialect", "")
	connection := CONF.GetString("database.connection", "")
	// clean testing database
	s.dbapi, err = NewDBAPI(dialect, connection)
	if err != nil {
		c.Error(err)
	}
	s.dbapi.db.MustExec("DROP SCHEMA IF EXISTS public CASCADE")
}