Commit 34fb817a authored by =Corey Hulen's avatar =Corey Hulen

Fixing unit tests

parent cbadc263
......@@ -5,6 +5,7 @@ package api
import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
)
......@@ -27,7 +28,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", FullName: "Mr. Benchmarker", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
Client.LoginByEmail(team.Domain, 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)
......
......@@ -5,6 +5,7 @@ package api
import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
)
......@@ -45,7 +46,7 @@ func CreateBasicUser(client *model.Client) *model.AppError {
if err != nil {
return err
}
Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id)
store.Must(Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id))
}
return nil
}
......@@ -72,7 +73,7 @@ func (cfg *AutoUserCreator) createRandomUser() (*model.User, bool) {
return nil, false
}
// We need to cheat to verify the user's email
Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id)
store.Must(Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id))
return result.Data.(*model.User), true
}
......
......@@ -5,6 +5,7 @@ package api
import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
"testing"
)
......@@ -139,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", FullName: "That Guy", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
Client.LoginByEmail(team.Domain, user.Email, "pwd")
// Benchmark Start
......
This diff is collapsed.
......@@ -5,6 +5,7 @@ package api
import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"testing"
)
......@@ -16,7 +17,7 @@ func TestSuggestRootCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -59,7 +60,7 @@ func TestLogoutCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -77,7 +78,7 @@ func TestJoinCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -91,7 +92,7 @@ func TestJoinCommands(t *testing.T) {
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
data := make(map[string]string)
data["user_id"] = user2.Id
......
......@@ -9,6 +9,7 @@ import (
"github.com/goamz/goamz/aws"
"github.com/goamz/goamz/s3"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
"io"
"mime/multipart"
......@@ -28,7 +29,7 @@ func TestUploadFile(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -115,7 +116,7 @@ func TestGetFile(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -177,7 +178,7 @@ func TestGetFile(t *testing.T) {
user2 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
newProps := make(map[string]string)
newProps["filename"] = filenames[0]
......@@ -262,11 +263,11 @@ func TestGetPublicLink(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......
......@@ -5,6 +5,7 @@ package api
import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
"net/http"
"testing"
......@@ -22,11 +23,11 @@ func TestCreatePost(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -104,7 +105,7 @@ func TestCreatePost(t *testing.T) {
user3 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user3.Id)
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
......@@ -133,11 +134,11 @@ func TestCreateValetPost(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -189,7 +190,7 @@ func TestCreateValetPost(t *testing.T) {
user3 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user3.Id)
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
......@@ -225,11 +226,11 @@ func TestUpdatePost(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -293,7 +294,7 @@ func TestGetPosts(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -358,7 +359,7 @@ func TestSearchPosts(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -404,7 +405,7 @@ func TestSearchHashtagPosts(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -435,7 +436,7 @@ func TestGetPostsCache(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -484,7 +485,7 @@ func TestDeletePosts(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -532,7 +533,7 @@ func TestEmailMention(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: "corey@test.com", FullName: "Bob Bobby", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -554,7 +555,7 @@ func TestFuzzyPosts(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......
......@@ -6,6 +6,7 @@ package api
import (
"fmt"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
"strings"
"testing"
......@@ -78,7 +79,7 @@ func TestCreateTeam(t *testing.T) {
user := &model.User{TeamId: rteam.Data.(*model.Team).Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -115,7 +116,7 @@ func TestFindTeamByEmail(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
if r1, err := Client.FindTeams(user.Email); err != nil {
t.Fatal(err)
......@@ -143,7 +144,7 @@ func TestFindTeamByDomain(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
if r1, err := Client.FindTeamByDomain(team.Domain, false); err != nil {
t.Fatal(err)
......@@ -183,7 +184,7 @@ func TestFindTeamByEmailSend(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
if _, err := Client.FindTeamsSendEmail(user.Email); err != nil {
t.Fatal(err)
......@@ -207,7 +208,7 @@ func TestInviteMembers(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -236,11 +237,11 @@ func TestUpdateTeamName(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: "test@nowhere.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......@@ -311,7 +312,7 @@ func TestGetMyTeam(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
ruser, _ := Client.CreateUser(&user, "")
Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id)
store.Must(Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id))
Client.LoginByEmail(team.Domain, user.Email, user.Password)
......@@ -338,18 +339,18 @@ func TestUpdateValetFeature(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: "test@nowhere.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
team2 := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
team2 = Client.Must(Client.CreateTeam(team2)).Data.(*model.Team)
user3 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user3.Id)
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......
......@@ -9,6 +9,7 @@ import (
"github.com/goamz/goamz/aws"
"github.com/goamz/goamz/s3"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
"image"
"image/color"
......@@ -99,7 +100,7 @@ func TestLogin(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
ruser, _ := Client.CreateUser(&user, "")
<-Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id)
store.Must(Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id))
if result, err := Client.LoginById(ruser.Data.(*model.User).Id, user.Password); err != nil {
t.Fatal(err)
......@@ -168,7 +169,7 @@ func TestSessions(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User)
Srv.Store.User().VerifyEmail(ruser.Id)
store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
deviceId := model.NewId()
Client.LoginByEmailWithDevice(team.Domain, user.Email, user.Password, deviceId)
......@@ -225,11 +226,11 @@ func TestGetUser(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
ruser, _ := Client.CreateUser(&user, "")
Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id)
store.Must(Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id))
user2 := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
ruser2, _ := Client.CreateUser(&user2, "")
Srv.Store.User().VerifyEmail(ruser2.Data.(*model.User).Id)
store.Must(Srv.Store.User().VerifyEmail(ruser2.Data.(*model.User).Id))
Client.LoginByEmail(team.Domain, user.Email, user.Password)
......@@ -296,7 +297,7 @@ func TestGetAudits(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
ruser, _ := Client.CreateUser(&user, "")
<-Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id)
store.Must(Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id))
time.Sleep(100 * time.Millisecond)
......@@ -349,7 +350,7 @@ func TestUserCreateImage(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -365,7 +366,7 @@ func TestUserUploadProfileImage(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
if utils.IsS3Configured() {
......@@ -464,7 +465,7 @@ func TestUserUpdate(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd", LastActivityAt: time1, LastPingAt: time1, Roles: ""}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
if _, err := Client.UpdateUser(user); err == nil {
t.Fatal("Should have errored")
......@@ -520,7 +521,7 @@ func TestUserUpdate(t *testing.T) {
user2 := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......@@ -539,7 +540,7 @@ func TestUserUpdatePassword(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
if _, err := Client.UpdateUserPassword(user.Id, "pwd", "newpwd"); err == nil {
t.Fatal("Should have errored")
......@@ -598,11 +599,11 @@ func TestUserUpdateRoles(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: "test@nowhere.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
user2 := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
data := make(map[string]string)
data["user_id"] = user.Id
......@@ -623,7 +624,7 @@ func TestUserUpdateRoles(t *testing.T) {
user3 := &model.User{TeamId: team2.Id, Email: "test@nowhere.com", FullName: "Corey Hulen", Password: "pwd"}
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user3.Id)
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
......@@ -667,11 +668,11 @@ func TestUserUpdateActive(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: "test@nowhere.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
user2 := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
if _, err := Client.UpdateActive(user.Id, false); err == nil {
t.Fatal("Should have errored, not logged in")
......@@ -688,7 +689,7 @@ func TestUserUpdateActive(t *testing.T) {
user3 := &model.User{TeamId: team2.Id, Email: "test@nowhere.com", FullName: "Corey Hulen", Password: "pwd"}
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user3.Id)
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
......@@ -731,7 +732,7 @@ func TestSendPasswordReset(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
data := make(map[string]string)
data["email"] = user.Email
......@@ -771,7 +772,7 @@ func TestResetPassword(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
data := make(map[string]string)
data["new_password"] = "newpwd"
......@@ -855,7 +856,7 @@ func TestUserUpdateNotify(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd", Roles: ""}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user.Id)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
data := make(map[string]string)
data["user_id"] = user.Id
......@@ -949,7 +950,7 @@ func TestStatuses(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User)
Srv.Store.User().VerifyEmail(ruser.Id)
store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
Client.LoginByEmail(team.Domain, user.Email, user.Password)
......
......@@ -6,6 +6,7 @@ package api
import (
"github.com/gorilla/websocket"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
"net/http"
"testing"
......@@ -21,7 +22,7 @@ func TestSocket(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user1.Id)
store.Must(Srv.Store.User().VerifyEmail(user1.Id))
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
channel1 := &model.Channel{DisplayName: "Test Web Scoket 1", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
......@@ -40,7 +41,7 @@ func TestSocket(t *testing.T) {
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
<-Srv.Store.User().VerifyEmail(user2.Id)
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
header2 := http.Header{}
......
......@@ -13,15 +13,15 @@ func TestSqlAuditStore(t *testing.T) {
Setup()
audit := &model.Audit{UserId: model.NewId(), IpAddress: "ipaddress", Action: "Action"}
<-store.Audit().Save(audit)
Must(store.Audit().Save(audit))