Commit ec2af296 authored by =Corey Hulen's avatar =Corey Hulen

fixing race condition in unit tests

parent 592d68cf
......@@ -27,7 +27,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)
<-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)
......
......@@ -139,7 +139,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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
// Benchmark Start
......
......@@ -20,7 +20,7 @@ func TestCreateChannel(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)
<-<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -88,11 +88,11 @@ func TestCreateDirectChannel(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)
<-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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -214,7 +214,7 @@ func TestUpdateChannelDesc(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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -257,7 +257,7 @@ func TestUpdateChannelDesc(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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......@@ -276,7 +276,7 @@ func TestGetChannel(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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -318,7 +318,7 @@ func TestGetMoreChannel(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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -330,7 +330,7 @@ func TestGetMoreChannel(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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......@@ -362,7 +362,7 @@ func TestJoinChannel(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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -374,7 +374,7 @@ func TestJoinChannel(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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......@@ -406,7 +406,7 @@ func TestLeaveChannel(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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -418,7 +418,7 @@ func TestLeaveChannel(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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......@@ -525,7 +525,7 @@ func TestGetChannelExtraInfo(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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -546,7 +546,7 @@ func TestAddChannelMember(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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -555,7 +555,7 @@ func TestAddChannelMember(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)
<-Srv.Store.User().VerifyEmail(user2.Id)
if _, err := Client.AddChannelMember(channel1.Id, user2.Id); err != nil {
t.Fatal(err)
......@@ -674,7 +674,7 @@ func TestUpdateNotifyLevel(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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -755,7 +755,7 @@ func TestFuzzyChannel(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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......
......@@ -16,7 +16,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -59,7 +59,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -77,7 +77,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -91,7 +91,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
data := make(map[string]string)
data["user_id"] = user2.Id
......
......@@ -28,7 +28,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -115,7 +115,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -177,7 +177,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)
<-Srv.Store.User().VerifyEmail(user2.Id)
newProps := make(map[string]string)
newProps["filename"] = filenames[0]
......@@ -262,11 +262,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)
<-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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......
......@@ -22,11 +22,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)
<-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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -104,7 +104,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)
<-Srv.Store.User().VerifyEmail(user3.Id)
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
......@@ -133,11 +133,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)
<-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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -189,7 +189,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)
<-Srv.Store.User().VerifyEmail(user3.Id)
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
......@@ -225,11 +225,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)
<-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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -293,7 +293,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -358,7 +358,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -404,7 +404,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -435,7 +435,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -484,7 +484,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -532,7 +532,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)
<-Srv.Store.User().VerifyEmail(user1.Id)
Client.LoginByEmail(team.Domain, user1.Email, "pwd")
......@@ -554,7 +554,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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......
......@@ -78,7 +78,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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -115,7 +115,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)
<-Srv.Store.User().VerifyEmail(user.Id)
if r1, err := Client.FindTeams(user.Email); err != nil {
t.Fatal(err)
......@@ -143,7 +143,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)
<-Srv.Store.User().VerifyEmail(user.Id)
if r1, err := Client.FindTeamByDomain(team.Domain, false); err != nil {
t.Fatal(err)
......@@ -183,7 +183,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)
<-Srv.Store.User().VerifyEmail(user.Id)
if _, err := Client.FindTeamsSendEmail(user.Email); err != nil {
t.Fatal(err)
......@@ -207,7 +207,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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -236,11 +236,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)
<-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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......@@ -338,18 +338,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)
<-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)
<-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)
<-Srv.Store.User().VerifyEmail(user3.Id)
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......
......@@ -99,7 +99,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)
<-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)
......@@ -347,7 +347,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)
<-Srv.Store.User().VerifyEmail(user.Id)
Client.LoginByEmail(team.Domain, user.Email, "pwd")
......@@ -363,7 +363,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)
<-Srv.Store.User().VerifyEmail(user.Id)
if utils.IsS3Configured() {
......@@ -462,7 +462,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)
<-<-Srv.Store.User().VerifyEmail(user.Id)
if _, err := Client.UpdateUser(user); err == nil {
t.Fatal("Should have errored")
......@@ -514,7 +514,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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
......@@ -533,7 +533,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)
<-Srv.Store.User().VerifyEmail(user.Id)
if _, err := Client.UpdateUserPassword(user.Id, "pwd", "newpwd"); err == nil {
t.Fatal("Should have errored")
......@@ -592,11 +592,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)
<-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)
<-Srv.Store.User().VerifyEmail(user2.Id)
data := make(map[string]string)
data["user_id"] = user.Id
......@@ -617,7 +617,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)
<-Srv.Store.User().VerifyEmail(user3.Id)
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
......@@ -661,11 +661,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)
<-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)
<-Srv.Store.User().VerifyEmail(user2.Id)
if _, err := Client.UpdateActive(user.Id, false); err == nil {
t.Fatal("Should have errored, not logged in")
......@@ -682,7 +682,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)
<-Srv.Store.User().VerifyEmail(user3.Id)
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
......@@ -725,7 +725,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)
<-Srv.Store.User().VerifyEmail(user.Id)
data := make(map[string]string)
data["email"] = user.Email
......@@ -765,7 +765,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)
<-Srv.Store.User().VerifyEmail(user.Id)
data := make(map[string]string)
data["new_password"] = "newpwd"
......@@ -849,7 +849,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)
<-Srv.Store.User().VerifyEmail(user.Id)
data := make(map[string]string)
data["user_id"] = user.Id
......
......@@ -21,7 +21,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)
<-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 +40,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)
<-Srv.Store.User().VerifyEmail(user2.Id)
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
header2 := http.Header{}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment