Commit 75f8729e authored by =Corey Hulen's avatar =Corey Hulen

PLT-7 adding loc db calls for users table

parent aac8d121
......@@ -128,7 +128,7 @@ func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if result := <-Srv.Store.User().Get(c.Session.UserId); result.Err != nil {
if result := <-Srv.Store.User().Get(c.T, c.Session.UserId); result.Err != nil {
c.Err = result.Err
return
} else {
......
......@@ -19,7 +19,7 @@ func TestGetLogs(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......@@ -63,7 +63,7 @@ func TestGetConfig(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......@@ -97,7 +97,7 @@ func TestSaveConfig(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......@@ -131,7 +131,7 @@ func TestEmailTest(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......@@ -159,7 +159,7 @@ func TestGetAnalyticsStandard(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......@@ -225,7 +225,7 @@ func TestGetPostCount(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......@@ -270,7 +270,7 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......
......@@ -31,7 +31,7 @@ func SetupBenchmark() (*model.Team, *model.User, *model.Channel) {
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
user := &model.User{TeamId: team.Id, Email: model.NewId() + "benchmark@test.com", Nickname: "Mr. Benchmarker", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
channel := &model.Channel{DisplayName: "Benchmark Channel", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
channel = Client.Must(Client.CreateChannel(channel)).Data.(*model.Channel)
......
......@@ -46,7 +46,7 @@ func CreateBasicUser(client *model.Client) *model.AppError {
if err != nil {
return err
}
store.Must(Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, result.Data.(*model.User).Id))
}
return nil
}
......@@ -73,7 +73,7 @@ func (cfg *AutoUserCreator) createRandomUser() (*model.User, bool) {
return nil, false
}
// We need to cheat to verify the user's email
store.Must(Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, result.Data.(*model.User).Id))
return result.Data.(*model.User), true
}
......
......@@ -125,7 +125,7 @@ func CreateDirectChannel(c *Context, otherUserId string) (*model.Channel, *model
return nil, model.NewAppError("CreateDirectChannel", "Invalid other user id ", otherUserId)
}
uc := Srv.Store.User().Get(otherUserId)
uc := Srv.Store.User().Get(c.T, otherUserId)
channel := new(model.Channel)
......@@ -292,7 +292,7 @@ func updateChannelHeader(c *Context, w http.ResponseWriter, r *http.Request) {
func PostUpdateChannelHeaderMessageAndForget(c *Context, channelId string, oldChannelHeader, newChannelHeader string) {
go func() {
uc := Srv.Store.User().Get(c.Session.UserId)
uc := Srv.Store.User().Get(c.T, c.Session.UserId)
if uresult := <-uc; uresult.Err != nil {
l4g.Error("Failed to retrieve user while trying to save update channel header message %v", uresult.Err)
......@@ -371,7 +371,7 @@ func getChannels(c *Context, w http.ResponseWriter, r *http.Request) {
if result := <-Srv.Store.Channel().GetChannels(c.T, c.Session.TeamId, c.Session.UserId); result.Err != nil {
if result.Err.Message == "No channels were found" {
// lets make sure the user is valid
if result := <-Srv.Store.User().Get(c.Session.UserId); result.Err != nil {
if result := <-Srv.Store.User().Get(c.T, c.Session.UserId); result.Err != nil {
c.Err = result.Err
c.RemoveSessionCookie(w, r)
l4g.Error("Error in getting users profile for id=%v forcing logout", c.Session.UserId)
......@@ -440,7 +440,7 @@ func join(c *Context, w http.ResponseWriter, r *http.Request) {
func JoinChannel(c *Context, channelId string, role string) {
sc := Srv.Store.Channel().Get(c.T, channelId)
uc := Srv.Store.User().Get(c.Session.UserId)
uc := Srv.Store.User().Get(c.T, c.Session.UserId)
if cresult := <-sc; cresult.Err != nil {
c.Err = cresult.Err
......@@ -544,7 +544,7 @@ func leave(c *Context, w http.ResponseWriter, r *http.Request) {
id := params["id"]
sc := Srv.Store.Channel().Get(c.T, id)
uc := Srv.Store.User().Get(c.Session.UserId)
uc := Srv.Store.User().Get(c.T, c.Session.UserId)
if cresult := <-sc; cresult.Err != nil {
c.Err = cresult.Err
......@@ -594,7 +594,7 @@ func deleteChannel(c *Context, w http.ResponseWriter, r *http.Request) {
sc := Srv.Store.Channel().Get(c.T, id)
scm := Srv.Store.Channel().GetMember(c.T, id, c.Session.UserId)
uc := Srv.Store.User().Get(c.Session.UserId)
uc := Srv.Store.User().Get(c.T, c.Session.UserId)
ihc := Srv.Store.Webhook().GetIncomingByChannel(c.T, id)
ohc := Srv.Store.Webhook().GetOutgoingByChannel(c.T, id)
......@@ -818,8 +818,8 @@ func addMember(c *Context, w http.ResponseWriter, r *http.Request) {
cchan := Srv.Store.Channel().CheckPermissionsTo(c.T, c.Session.TeamId, id, c.Session.UserId)
sc := Srv.Store.Channel().Get(c.T, id)
ouc := Srv.Store.User().Get(c.Session.UserId)
nuc := Srv.Store.User().Get(userId)
ouc := Srv.Store.User().Get(c.T, c.Session.UserId)
nuc := Srv.Store.User().Get(c.T, userId)
// Only need to be a member of the channel to add a new member
if !c.HasPermissionsToChannel(cchan, "addMember") {
......
......@@ -140,7 +140,7 @@ func BenchmarkJoinChannel(b *testing.B) {
// Secondary test user to join channels created by primary test user
user := &model.User{TeamId: team.Id, Email: model.NewId() + "random@test.com", Nickname: "That Guy", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
// Benchmark Start
......
This diff is collapsed.
......@@ -544,7 +544,7 @@ func loadTestPostsCommand(c *Context, command *model.Command) bool {
}
var usernames []string
if result := <-Srv.Store.User().GetProfiles(c.Session.TeamId); result.Err == nil {
if result := <-Srv.Store.User().GetProfiles(c.T, c.Session.TeamId); result.Err == nil {
profileUsers := result.Data.(map[string]*model.User)
usernames = make([]string, len(profileUsers))
i := 0
......
......@@ -21,7 +21,7 @@ func TestSuggestRootCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -70,7 +70,7 @@ func TestLogoutCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -88,7 +88,7 @@ func TestJoinCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -102,7 +102,7 @@ func TestJoinCommands(t *testing.T) {
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
data := make(map[string]string)
data["user_id"] = user2.Id
......@@ -164,7 +164,7 @@ func TestEchoCommand(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -202,7 +202,7 @@ func TestLoadTestUrlCommand(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......
......@@ -195,7 +195,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if c.Err == nil && h.isUserActivity && token != "" && len(c.Session.UserId) > 0 {
go func() {
if err := (<-Srv.Store.User().UpdateUserAndSessionActivity(c.Session.UserId, c.Session.Id, model.GetMillis())).Err; err != nil {
if err := (<-Srv.Store.User().UpdateUserAndSessionActivity(c.T, c.Session.UserId, c.Session.Id, model.GetMillis())).Err; err != nil {
l4g.Error("Failed to update LastActivityAt for user_id=%v and session_id=%v, err=%v", c.Session.UserId, c.Session.Id, err)
}
}()
......
......@@ -125,7 +125,7 @@ func ExportTeams(T goi18n.TranslateFunc, writer ExportWriter, options *ExportOpt
if err := ExportChannels(T, writer, options, team.Id); err != nil {
return err
}
if err := ExportUsers(writer, options, team.Id); err != nil {
if err := ExportUsers(T, writer, options, team.Id); err != nil {
return err
}
if err := ExportLocalStorage(writer, options, team.Id); err != nil {
......@@ -225,10 +225,10 @@ func ExportPosts(T goi18n.TranslateFunc, writer ExportWriter, options *ExportOpt
return nil
}
func ExportUsers(writer ExportWriter, options *ExportOptions, teamId string) *model.AppError {
func ExportUsers(T goi18n.TranslateFunc, writer ExportWriter, options *ExportOptions, teamId string) *model.AppError {
// Get the users
var users []*model.User
if result := <-Srv.Store.User().GetForExport(teamId); result.Err != nil {
if result := <-Srv.Store.User().GetForExport(T, teamId); result.Err != nil {
return result.Err
} else {
users = result.Data.([]*model.User)
......
......@@ -29,7 +29,7 @@ func TestUploadFile(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -144,7 +144,7 @@ func TestGetFile(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -214,7 +214,7 @@ func TestGetFile(t *testing.T) {
user2 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
newProps := make(map[string]string)
newProps["filename"] = filenames[0]
......@@ -322,11 +322,11 @@ func TestGetPublicLink(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......
......@@ -25,7 +25,7 @@ func ImportPost(T goi18n.TranslateFunc, post *model.Post) {
func ImportUser(T goi18n.TranslateFunc, user *model.User) *model.User {
user.MakeNonNil()
if result := <-Srv.Store.User().Save(user); result.Err != nil {
if result := <-Srv.Store.User().Save(T, user); result.Err != nil {
l4g.Error("Error saving user. err=%v", result.Err)
return nil
} else {
......@@ -35,7 +35,7 @@ func ImportUser(T goi18n.TranslateFunc, user *model.User) *model.User {
l4g.Error("Encountered an issue joining default channels user_id=%s, team_id=%s, err=%v", ruser.Id, ruser.TeamId, err)
}
if cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil {
if cresult := <-Srv.Store.User().VerifyEmail(T, ruser.Id); cresult.Err != nil {
l4g.Error("Failed to set email verified err=%v", cresult.Err)
}
......
......@@ -20,7 +20,7 @@ func TestRegisterApp(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey+test@test.com", Password: "pwd"}
ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, ruser.Id))
app := &model.OAuthApp{Name: "TestApp" + model.NewId(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}}
......@@ -77,7 +77,7 @@ func TestAllowOAuth(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey+test@test.com", Password: "pwd"}
ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, ruser.Id))
app := &model.OAuthApp{Name: "TestApp" + model.NewId(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}}
......
......@@ -207,7 +207,7 @@ func handlePostEventsAndForget(c *Context, post *model.Post, triggerWebhooks boo
go func() {
tchan := Srv.Store.Team().Get(c.T, c.Session.TeamId)
cchan := Srv.Store.Channel().Get(c.T, post.ChannelId)
uchan := Srv.Store.User().Get(post.UserId)
uchan := Srv.Store.User().Get(c.T, post.UserId)
var team *model.Team
if result := <-tchan; result.Err != nil {
......@@ -394,7 +394,7 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team,
go func() {
// Get a list of user names (to be used as keywords) and ids for the given team
uchan := Srv.Store.User().GetProfiles(c.Session.TeamId)
uchan := Srv.Store.User().GetProfiles(c.T, c.Session.TeamId)
echan := Srv.Store.Channel().GetMembers(c.T, post.ChannelId)
var channelName string
......
......@@ -23,11 +23,11 @@ func TestCreatePost(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -105,7 +105,7 @@ func TestCreatePost(t *testing.T) {
user3 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user3.Id))
Client.LoginByEmail(team2.Name, user3.Email, "pwd")
......@@ -134,11 +134,11 @@ func TestUpdatePost(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -202,7 +202,7 @@ func TestGetPosts(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -267,7 +267,7 @@ func TestGetPostsSince(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -337,7 +337,7 @@ func TestGetPostsBeforeAfter(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -414,7 +414,7 @@ func TestSearchPosts(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -464,7 +464,7 @@ func TestSearchHashtagPosts(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -495,7 +495,7 @@ func TestSearchPostsInChannel(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -577,7 +577,7 @@ func TestSearchPostsFromUser(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -592,7 +592,7 @@ func TestSearchPostsFromUser(t *testing.T) {
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
Client.LoginByEmail(team.Name, user2.Email, "pwd")
Client.Must(Client.JoinChannel(channel1.Id))
......@@ -621,7 +621,7 @@ func TestSearchPostsFromUser(t *testing.T) {
user3 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user3.Id))
Client.LoginByEmail(team.Name, user3.Email, "pwd")
Client.Must(Client.JoinChannel(channel1.Id))
......@@ -655,7 +655,7 @@ func TestGetPostsCache(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -704,11 +704,11 @@ func TestDeletePosts(t *testing.T) {
userAdmin := &model.User{TeamId: team.Id, Email: team.Email, Nickname: "Corey Hulen", Password: "pwd"}
userAdmin = Client.Must(Client.CreateUser(userAdmin, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(userAdmin.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, userAdmin.Id))
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -765,7 +765,7 @@ func TestEmailMention(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: "corey+test@test.com", Nickname: "Bob Bobby", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -787,7 +787,7 @@ func TestFuzzyPosts(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
......@@ -814,11 +814,11 @@ func TestMakeDirectChannelVisible(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
// user2 will be created with prefs created to show user1 in the sidebar so set that to false to get rid of it
Client.LoginByEmail(team.Name, user2.Email, "pwd")
......
......@@ -6,6 +6,7 @@ package api
import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
"testing"
)
......@@ -17,11 +18,11 @@ func TestGetAllPreferences(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
category := model.NewId()
......@@ -70,7 +71,7 @@ func TestSetPreferences(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd")
......@@ -101,7 +102,7 @@ func TestSetPreferences(t *testing.T) {
// not able to update as a different user
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
Client.LoginByEmail(team.Name, user2.Email, "pwd")
......@@ -118,11 +119,11 @@ func TestGetPreferenceCategory(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
category := model.NewId()
......@@ -174,7 +175,7 @@ func TestGetPreference(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com",