예제 #1
0
func createAuthService() (Auth, store, *mailermock.MailerMock) {
	db, err := sql.Open("postgres", "postgres://drome:@localhost/fservices_test?sslmode=disable")
	// db, err := sql.Open("sqlite3", ":memory:")
	util.PanicIfNotNil(err)

	_, err = db.Exec(`
		CREATE SCHEMA IF NOT EXISTS auth;
		DROP SCHEMA auth CASCADE;
	`)
	// _, err = db.Exec(`
	// 	DROP TABLE IF EXISTS auth_user;
	// `)
	util.PanicIfNotNil(err)

	storePg := NewStorePg(db)
	util.PanicIfNotNil(storePg.createSchema())

	mailer := new(mailermock.MailerMock)

	return NewAuth(cfg, storePg, mailer), storePg, mailer
}
예제 #2
0
func setup() {
	_, err := toml.DecodeFile("auth_test.toml", &cfg)
	util.PanicIfNotNil(err)
}