Changing the way we mattermost handles URLs. team.domain.com becomes domain.com/team.
Renaming team.Name to team.DisplayName and team.Domain to team.Name. So: team.Name -> url safe name. team.DisplayName -> nice name for users
Этот коммит содержится в:
104
api/user_test.go
104
api/user_test.go
@@ -25,7 +25,7 @@ import (
|
||||
func TestCreateUser(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
rteam, _ := Client.CreateTeam(&team)
|
||||
|
||||
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "hello"}
|
||||
@@ -75,7 +75,7 @@ func TestCreateUser(t *testing.T) {
|
||||
func TestCreateUserAllowedDomains(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_INVITE, AllowedDomains: "spinpunch.com, @nowh.com,@hello.com"}
|
||||
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_INVITE, AllowedDomains: "spinpunch.com, @nowh.com,@hello.com"}
|
||||
rteam, _ := Client.CreateTeam(&team)
|
||||
|
||||
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "hello"}
|
||||
@@ -95,7 +95,7 @@ func TestCreateUserAllowedDomains(t *testing.T) {
|
||||
func TestLogin(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
rteam, _ := Client.CreateTeam(&team)
|
||||
|
||||
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -110,7 +110,7 @@ func TestLogin(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if result, err := Client.LoginByEmail(team.Domain, user.Email, user.Password); err != nil {
|
||||
if result, err := Client.LoginByEmail(team.Name, user.Email, user.Password); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
if result.Data.(*model.User).Email != user.Email {
|
||||
@@ -118,11 +118,11 @@ func TestLogin(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := Client.LoginByEmail(team.Domain, user.Email, user.Password+"invalid"); err == nil {
|
||||
if _, err := Client.LoginByEmail(team.Name, user.Email, user.Password+"invalid"); err == nil {
|
||||
t.Fatal("Invalid Password")
|
||||
}
|
||||
|
||||
if _, err := Client.LoginByEmail(team.Domain, "", user.Password); err == nil {
|
||||
if _, err := Client.LoginByEmail(team.Name, "", user.Password); err == nil {
|
||||
t.Fatal("should have failed")
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ func TestLogin(t *testing.T) {
|
||||
|
||||
Client.AuthToken = ""
|
||||
|
||||
team2 := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_INVITE}
|
||||
team2 := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_INVITE}
|
||||
rteam2 := Client.Must(Client.CreateTeam(&team2))
|
||||
|
||||
user2 := model.User{TeamId: rteam2.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -147,14 +147,14 @@ func TestLogin(t *testing.T) {
|
||||
props := make(map[string]string)
|
||||
props["email"] = user2.Email
|
||||
props["id"] = rteam2.Data.(*model.Team).Id
|
||||
props["name"] = rteam2.Data.(*model.Team).Name
|
||||
props["display_name"] = rteam2.Data.(*model.Team).DisplayName
|
||||
props["time"] = fmt.Sprintf("%v", model.GetMillis())
|
||||
data := model.MapToJson(props)
|
||||
hash := model.HashPassword(fmt.Sprintf("%v:%v", data, utils.Cfg.ServiceSettings.InviteSalt))
|
||||
|
||||
ruser2, _ := Client.CreateUserFromSignup(&user2, data, hash)
|
||||
|
||||
if _, err := Client.LoginByEmail(team2.Domain, ruser2.Data.(*model.User).Email, user2.Password); err != nil {
|
||||
if _, err := Client.LoginByEmail(team2.Name, ruser2.Data.(*model.User).Email, user2.Password); err != nil {
|
||||
t.Fatal("From verfied hash")
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ func TestLogin(t *testing.T) {
|
||||
func TestSessions(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
rteam, _ := Client.CreateTeam(&team)
|
||||
|
||||
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -172,8 +172,8 @@ func TestSessions(t *testing.T) {
|
||||
store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
|
||||
|
||||
deviceId := model.NewId()
|
||||
Client.LoginByEmailWithDevice(team.Domain, user.Email, user.Password, deviceId)
|
||||
Client.LoginByEmail(team.Domain, user.Email, user.Password)
|
||||
Client.LoginByEmailWithDevice(team.Name, user.Email, user.Password, deviceId)
|
||||
Client.LoginByEmail(team.Name, user.Email, user.Password)
|
||||
|
||||
r1, err := Client.GetSessions(ruser.Id)
|
||||
if err != nil {
|
||||
@@ -221,7 +221,7 @@ func TestSessions(t *testing.T) {
|
||||
func TestGetUser(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
rteam, _ := Client.CreateTeam(&team)
|
||||
|
||||
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -232,7 +232,7 @@ func TestGetUser(t *testing.T) {
|
||||
ruser2, _ := Client.CreateUser(&user2, "")
|
||||
store.Must(Srv.Store.User().VerifyEmail(ruser2.Data.(*model.User).Id))
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, user.Password)
|
||||
Client.LoginByEmail(team.Name, user.Email, user.Password)
|
||||
|
||||
rId := ruser.Data.(*model.User).Id
|
||||
if result, err := Client.GetUser(rId, ""); err != nil {
|
||||
@@ -292,7 +292,7 @@ func TestGetUser(t *testing.T) {
|
||||
func TestGetAudits(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
rteam, _ := Client.CreateTeam(&team)
|
||||
|
||||
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -301,7 +301,7 @@ func TestGetAudits(t *testing.T) {
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, user.Password)
|
||||
Client.LoginByEmail(team.Name, user.Email, user.Password)
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
@@ -345,14 +345,14 @@ func TestUserCreateImage(t *testing.T) {
|
||||
t.Fatal("Failed to create correct color")
|
||||
}
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
|
||||
store.Must(Srv.Store.User().VerifyEmail(user.Id))
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user.Email, "pwd")
|
||||
|
||||
Client.DoGet("/users/"+user.Id+"/image", "", "")
|
||||
|
||||
@@ -361,7 +361,7 @@ func TestUserCreateImage(t *testing.T) {
|
||||
func TestUserUploadProfileImage(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -377,7 +377,7 @@ func TestUserUploadProfileImage(t *testing.T) {
|
||||
t.Fatal("Should have errored")
|
||||
}
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user.Email, "pwd")
|
||||
|
||||
if _, upErr := Client.UploadFile("/users/newimage", body.Bytes(), writer.FormDataContentType()); upErr == nil {
|
||||
t.Fatal("Should have errored")
|
||||
@@ -458,7 +458,7 @@ func TestUserUploadProfileImage(t *testing.T) {
|
||||
func TestUserUpdate(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
time1 := model.GetMillis()
|
||||
@@ -471,7 +471,7 @@ func TestUserUpdate(t *testing.T) {
|
||||
t.Fatal("Should have errored")
|
||||
}
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user.Email, "pwd")
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
@@ -523,7 +523,7 @@ func TestUserUpdate(t *testing.T) {
|
||||
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
|
||||
store.Must(Srv.Store.User().VerifyEmail(user2.Id))
|
||||
|
||||
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user2.Email, "pwd")
|
||||
|
||||
user.Nickname = "Tim Timmy"
|
||||
|
||||
@@ -535,7 +535,7 @@ func TestUserUpdate(t *testing.T) {
|
||||
func TestUserUpdatePassword(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -546,7 +546,7 @@ func TestUserUpdatePassword(t *testing.T) {
|
||||
t.Fatal("Should have errored")
|
||||
}
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user.Email, "pwd")
|
||||
|
||||
if _, err := Client.UpdateUserPassword("123", "pwd", "newpwd"); err == nil {
|
||||
t.Fatal("Should have errored")
|
||||
@@ -577,14 +577,14 @@ func TestUserUpdatePassword(t *testing.T) {
|
||||
t.Fatal("LastPasswordUpdate should have changed")
|
||||
}
|
||||
|
||||
if _, err := Client.LoginByEmail(team.Domain, user.Email, "newpwd"); err != nil {
|
||||
if _, err := Client.LoginByEmail(team.Name, user.Email, "newpwd"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
user2 := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
|
||||
|
||||
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user2.Email, "pwd")
|
||||
|
||||
if _, err := Client.UpdateUserPassword(user.Id, "pwd", "newpwd"); err == nil {
|
||||
t.Fatal("Should have errored")
|
||||
@@ -594,7 +594,7 @@ func TestUserUpdatePassword(t *testing.T) {
|
||||
func TestUserUpdateRoles(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user := &model.User{TeamId: team.Id, Email: "test@nowhere.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -613,20 +613,20 @@ func TestUserUpdateRoles(t *testing.T) {
|
||||
t.Fatal("Should have errored, not logged in")
|
||||
}
|
||||
|
||||
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user2.Email, "pwd")
|
||||
|
||||
if _, err := Client.UpdateUserRoles(data); err == nil {
|
||||
t.Fatal("Should have errored, not admin")
|
||||
}
|
||||
|
||||
team2 := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team2 := &model.Team{DisplayName: "Name", Name: "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: "test@nowhere.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
|
||||
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
|
||||
|
||||
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
|
||||
Client.LoginByEmail(team2.Name, user3.Email, "pwd")
|
||||
|
||||
data["user_id"] = user2.Id
|
||||
|
||||
@@ -634,7 +634,7 @@ func TestUserUpdateRoles(t *testing.T) {
|
||||
t.Fatal("Should have errored, wrong team")
|
||||
}
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user.Email, "pwd")
|
||||
|
||||
data["user_id"] = "junk"
|
||||
data["new_roles"] = "admin"
|
||||
@@ -663,7 +663,7 @@ func TestUserUpdateRoles(t *testing.T) {
|
||||
func TestUserUpdateActive(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user := &model.User{TeamId: team.Id, Email: "test@nowhere.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -678,26 +678,26 @@ func TestUserUpdateActive(t *testing.T) {
|
||||
t.Fatal("Should have errored, not logged in")
|
||||
}
|
||||
|
||||
Client.LoginByEmail(team.Domain, user2.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user2.Email, "pwd")
|
||||
|
||||
if _, err := Client.UpdateActive(user.Id, false); err == nil {
|
||||
t.Fatal("Should have errored, not admin")
|
||||
}
|
||||
|
||||
team2 := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team2 := &model.Team{DisplayName: "Name", Name: "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: "test@nowhere.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
|
||||
store.Must(Srv.Store.User().VerifyEmail(user3.Id))
|
||||
|
||||
Client.LoginByEmail(team2.Domain, user3.Email, "pwd")
|
||||
Client.LoginByEmail(team2.Name, user3.Email, "pwd")
|
||||
|
||||
if _, err := Client.UpdateActive(user.Id, false); err == nil {
|
||||
t.Fatal("Should have errored, wrong team")
|
||||
}
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user.Email, "pwd")
|
||||
|
||||
if _, err := Client.UpdateActive("junk", false); err == nil {
|
||||
t.Fatal("Should have errored, bad id")
|
||||
@@ -727,7 +727,7 @@ func TestUserUpdateActive(t *testing.T) {
|
||||
func TestSendPasswordReset(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -736,7 +736,7 @@ func TestSendPasswordReset(t *testing.T) {
|
||||
|
||||
data := make(map[string]string)
|
||||
data["email"] = user.Email
|
||||
data["domain"] = team.Domain
|
||||
data["name"] = team.Name
|
||||
|
||||
if _, err := Client.SendPasswordReset(data); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -753,21 +753,21 @@ func TestSendPasswordReset(t *testing.T) {
|
||||
}
|
||||
|
||||
data["email"] = user.Email
|
||||
data["domain"] = ""
|
||||
data["name"] = ""
|
||||
if _, err := Client.SendPasswordReset(data); err == nil {
|
||||
t.Fatal("Should have errored - no domain")
|
||||
t.Fatal("Should have errored - no name")
|
||||
}
|
||||
|
||||
data["domain"] = "junk"
|
||||
data["name"] = "junk"
|
||||
if _, err := Client.SendPasswordReset(data); err == nil {
|
||||
t.Fatal("Should have errored - bad domain")
|
||||
t.Fatal("Should have errored - bad name")
|
||||
}
|
||||
}
|
||||
|
||||
func TestResetPassword(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
@@ -781,7 +781,7 @@ func TestResetPassword(t *testing.T) {
|
||||
props["time"] = fmt.Sprintf("%v", model.GetMillis())
|
||||
data["data"] = model.MapToJson(props)
|
||||
data["hash"] = model.HashPassword(fmt.Sprintf("%v:%v", data["data"], utils.Cfg.ServiceSettings.ResetSalt))
|
||||
data["domain"] = team.Domain
|
||||
data["name"] = team.Name
|
||||
|
||||
if _, err := Client.ResetPassword(data); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -839,10 +839,10 @@ func TestResetPassword(t *testing.T) {
|
||||
t.Fatal("Should have errored - bad domain")
|
||||
}
|
||||
|
||||
team2 := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test2@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team2 := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test2@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team2 = Client.Must(Client.CreateTeam(team2)).Data.(*model.Team)
|
||||
|
||||
data["domain"] = team2.Domain
|
||||
data["domain"] = team2.Name
|
||||
if _, err := Client.ResetPassword(data); err == nil {
|
||||
t.Fatal("Should have errored - domain team doesn't match user team")
|
||||
}
|
||||
@@ -851,7 +851,7 @@ func TestResetPassword(t *testing.T) {
|
||||
func TestUserUpdateNotify(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
|
||||
|
||||
user := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd", Roles: ""}
|
||||
@@ -868,7 +868,7 @@ func TestUserUpdateNotify(t *testing.T) {
|
||||
t.Fatal("Should have errored - not logged in")
|
||||
}
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, "pwd")
|
||||
Client.LoginByEmail(team.Name, user.Email, "pwd")
|
||||
|
||||
if result, err := Client.UpdateUserNotify(data); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -919,7 +919,7 @@ func TestUserUpdateNotify(t *testing.T) {
|
||||
|
||||
func TestFuzzyUserCreate(t *testing.T) {
|
||||
|
||||
team := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
rteam, _ := Client.CreateTeam(&team)
|
||||
|
||||
for i := 0; i < len(utils.FUZZY_STRINGS_NAMES) || i < len(utils.FUZZY_STRINGS_EMAILS); i++ {
|
||||
@@ -945,14 +945,14 @@ func TestFuzzyUserCreate(t *testing.T) {
|
||||
func TestStatuses(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
team := model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
|
||||
rteam, _ := Client.CreateTeam(&team)
|
||||
|
||||
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
|
||||
ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User)
|
||||
store.Must(Srv.Store.User().VerifyEmail(ruser.Id))
|
||||
|
||||
Client.LoginByEmail(team.Domain, user.Email, user.Password)
|
||||
Client.LoginByEmail(team.Name, user.Email, user.Password)
|
||||
|
||||
r1, err := Client.GetStatuses()
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user