func (me *TestHelper) CreateTeam(client *model.Client) *model.Team { id := model.NewId() team := &model.Team{ DisplayName: "dn_" + id, Name: "name" + id, Email: "success+" + id + "@simulator.amazonses.com", Type: model.TEAM_OPEN, } utils.DisableDebugLogForTest() r := client.Must(client.CreateTeam(team)).Data.(*model.Team) utils.EnableDebugLogForTest() return r }
// 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 }