Ejemplo n.º 1
0
func (me *TestHelper) CreateUser(client *model.Client) *model.User {
	id := model.NewId()

	user := &model.User{
		Email:    "success+" + id + "@simulator.amazonses.com",
		Username: "******" + id,
		Nickname: "nn_" + id,
		Password: "******",
	}

	utils.DisableDebugLogForTest()
	ruser := client.Must(client.CreateUser(user, "")).Data.(*model.User)
	ruser.Password = "******"
	store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
	utils.EnableDebugLogForTest()
	return ruser
}
Ejemplo n.º 2
0
// Basic test team and user so you always know one
func CreateBasicUser(client *model.Client) *model.AppError {
	result, _ := client.FindTeamByName(BTEST_TEAM_NAME, true)
	if result.Data.(bool) == false {
		newteam := &model.Team{DisplayName: BTEST_TEAM_DISPLAY_NAME, Name: BTEST_TEAM_NAME, Email: BTEST_TEAM_EMAIL, Type: BTEST_TEAM_TYPE}
		result, err := client.CreateTeam(newteam)
		if err != nil {
			return err
		}
		basicteam := result.Data.(*model.Team)
		newuser := &model.User{TeamId: basicteam.Id, Email: BTEST_USER_EMAIL, Nickname: BTEST_USER_NAME, Password: BTEST_USER_PASSWORD}
		result, err = client.CreateUser(newuser, "")
		if err != nil {
			return err
		}
		store.Must(Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id))
	}
	return nil
}