Ejemplo n.º 1
0
func MustCreateAccount(dbmap *gorp.DbMap, email string) *rr.Account {
	account := rr.NewAccount(email)
	err := dbmap.Insert(account)
	if err != nil {
		panic(err.Error())
	}
	return account
}
func Test_NewAccountEmailJob(t *testing.T) {
	dbmap := initTestDb(t)
	defer dbmap.Db.Close()

	os.Setenv("RR_ROOT", "..")

	account := rr.NewAccount("*****@*****.**")
	token := "confirm1234"
	account.ConfirmationToken = &token
	err := dbmap.Insert(account)
	ok(t, err)

	job := rr.NewAccountEmailJob{
		AccountId: account.Id,
	}

	message, err := job.CreateMessage(account)
	ok(t, err)

	expectInclude(t, message.Body, "/confirm/confirm1234")
}