Commit 7d60d96c authored by Pat Lathem's avatar Pat Lathem

Fix spelling of environment

parent e6826c4d
...@@ -10,42 +10,42 @@ import ( ...@@ -10,42 +10,42 @@ import (
"time" "time"
) )
type TestEnviroment struct { type TestEnvironment struct {
Teams []*model.Team Teams []*model.Team
Enviroments []TeamEnviroment Environments []TeamEnvironment
} }
func CreateTestEnviromentWithTeams(client *model.Client, rangeTeams utils.Range, rangeChannels utils.Range, rangeUsers utils.Range, rangePosts utils.Range, fuzzy bool) (TestEnviroment, bool) { func CreateTestEnvironmentWithTeams(client *model.Client, rangeTeams utils.Range, rangeChannels utils.Range, rangeUsers utils.Range, rangePosts utils.Range, fuzzy bool) (TestEnvironment, bool) {
rand.Seed(time.Now().UTC().UnixNano()) rand.Seed(time.Now().UTC().UnixNano())
teamCreator := NewAutoTeamCreator(client) teamCreator := NewAutoTeamCreator(client)
teamCreator.Fuzzy = fuzzy teamCreator.Fuzzy = fuzzy
teams, err := teamCreator.CreateTestTeams(rangeTeams) teams, err := teamCreator.CreateTestTeams(rangeTeams)
if err != true { if err != true {
return TestEnviroment{}, false return TestEnvironment{}, false
} }
enviroment := TestEnviroment{teams, make([]TeamEnviroment, len(teams))} environment := TestEnvironment{teams, make([]TeamEnvironment, len(teams))}
for i, team := range teams { for i, team := range teams {
userCreator := NewAutoUserCreator(client, team.Id) userCreator := NewAutoUserCreator(client, team.Id)
userCreator.Fuzzy = fuzzy userCreator.Fuzzy = fuzzy
randomUser, err := userCreator.createRandomUser() randomUser, err := userCreator.createRandomUser()
if err != true { if err != true {
return TestEnviroment{}, false return TestEnvironment{}, false
} }
client.LoginById(randomUser.Id, USER_PASSWORD) client.LoginById(randomUser.Id, USER_PASSWORD)
teamEnviroment, err := CreateTestEnviromentInTeam(client, team.Id, rangeChannels, rangeUsers, rangePosts, fuzzy) teamEnvironment, err := CreateTestEnvironmentInTeam(client, team.Id, rangeChannels, rangeUsers, rangePosts, fuzzy)
if err != true { if err != true {
return TestEnviroment{}, false return TestEnvironment{}, false
} }
enviroment.Enviroments[i] = teamEnviroment environment.Environments[i] = teamEnvironment
} }
return enviroment, true return environment, true
} }
func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChannels utils.Range, rangeUsers utils.Range, rangePosts utils.Range, fuzzy bool) (TeamEnviroment, bool) { func CreateTestEnvironmentInTeam(client *model.Client, teamID string, rangeChannels utils.Range, rangeUsers utils.Range, rangePosts utils.Range, fuzzy bool) (TeamEnvironment, bool) {
rand.Seed(time.Now().UTC().UnixNano()) rand.Seed(time.Now().UTC().UnixNano())
// We need to create at least one user // We need to create at least one user
...@@ -57,7 +57,7 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne ...@@ -57,7 +57,7 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne
userCreator.Fuzzy = fuzzy userCreator.Fuzzy = fuzzy
users, err := userCreator.CreateTestUsers(rangeUsers) users, err := userCreator.CreateTestUsers(rangeUsers)
if err != true { if err != true {
return TeamEnviroment{}, false return TeamEnvironment{}, false
} }
usernames := make([]string, len(users)) usernames := make([]string, len(users))
for i, user := range users { for i, user := range users {
...@@ -77,7 +77,7 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne ...@@ -77,7 +77,7 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne
} }
if err != true { if err != true {
return TeamEnviroment{}, false return TeamEnvironment{}, false
} }
numPosts := utils.RandIntFromRange(rangePosts) numPosts := utils.RandIntFromRange(rangePosts)
numImages := utils.RandIntFromRange(rangePosts) / 4 numImages := utils.RandIntFromRange(rangePosts) / 4
...@@ -93,5 +93,5 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne ...@@ -93,5 +93,5 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne
} }
} }
return TeamEnviroment{users, channels}, true return TeamEnvironment{users, channels}, true
} }
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/mattermost/platform/utils" "github.com/mattermost/platform/utils"
) )
type TeamEnviroment struct { type TeamEnvironment struct {
Users []*model.User Users []*model.User
Channels []*model.Channel Channels []*model.Channel
} }
......
...@@ -381,11 +381,11 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool { ...@@ -381,11 +381,11 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool {
if doTeams { if doTeams {
if err := CreateBasicUser(client); err != nil { if err := CreateBasicUser(client); err != nil {
l4g.Error("Failed to create testing enviroment") l4g.Error("Failed to create testing environment")
return true return true
} }
client.LoginByEmail(BTEST_TEAM_NAME, BTEST_USER_EMAIL, BTEST_USER_PASSWORD) client.LoginByEmail(BTEST_TEAM_NAME, BTEST_USER_EMAIL, BTEST_USER_PASSWORD)
enviroment, err := CreateTestEnviromentWithTeams( environment, err := CreateTestEnvironmentWithTeams(
client, client,
utils.Range{numTeams, numTeams}, utils.Range{numTeams, numTeams},
utils.Range{numChannels, numChannels}, utils.Range{numChannels, numChannels},
...@@ -393,18 +393,18 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool { ...@@ -393,18 +393,18 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool {
utils.Range{numPosts, numPosts}, utils.Range{numPosts, numPosts},
doFuzz) doFuzz)
if err != true { if err != true {
l4g.Error("Failed to create testing enviroment") l4g.Error("Failed to create testing environment")
return true return true
} else { } else {
l4g.Info("Testing enviroment created") l4g.Info("Testing environment created")
for i := 0; i < len(enviroment.Teams); i++ { for i := 0; i < len(environment.Teams); i++ {
l4g.Info("Team Created: " + enviroment.Teams[i].Name) l4g.Info("Team Created: " + environment.Teams[i].Name)
l4g.Info("\t User to login: " + enviroment.Enviroments[i].Users[0].Email + ", " + USER_PASSWORD) l4g.Info("\t User to login: " + environment.Environments[i].Users[0].Email + ", " + USER_PASSWORD)
} }
} }
} else { } else {
client.MockSession(c.Session.Token) client.MockSession(c.Session.Token)
CreateTestEnviromentInTeam( CreateTestEnvironmentInTeam(
client, client,
c.Session.TeamId, c.Session.TeamId,
utils.Range{numChannels, numChannels}, utils.Range{numChannels, numChannels},
...@@ -416,7 +416,7 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool { ...@@ -416,7 +416,7 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool {
} else if strings.Index(cmd, command.Command) == 0 { } else if strings.Index(cmd, command.Command) == 0 {
command.AddSuggestion(&model.SuggestCommand{ command.AddSuggestion(&model.SuggestCommand{
Suggestion: cmd, Suggestion: cmd,
Description: "Creates a testing enviroment in current team. [teams] [fuzz] <Num Channels> <Num Users> <NumPosts>"}) Description: "Creates a testing environment in current team. [teams] [fuzz] <Num Channels> <Num Users> <NumPosts>"})
} }
return false return false
......
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
"time" "time"
) )
type TestEnviroment struct { type TestEnvironment struct {
Params map[string][]string Params map[string][]string
Client *model.Client Client *model.Client
CreatedTeamId string CreatedTeamId string
...@@ -121,8 +121,8 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) { ...@@ -121,8 +121,8 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/channels/town-square", http.StatusTemporaryRedirect) http.Redirect(w, r, "/channels/town-square", http.StatusTemporaryRedirect)
} }
// Setup test enviroment // Setup test environment
env := TestEnviroment{ env := TestEnvironment{
Params: params, Params: params,
Client: client, Client: client,
CreatedTeamId: teamID, CreatedTeamId: teamID,
......
...@@ -19,7 +19,7 @@ http://www.google.com.pk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8 ...@@ -19,7 +19,7 @@ http://www.google.com.pk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8
https://medium.com/@slackhq/11-useful-tips-for-getting-the-most-of-slack-5dfb3d1af77 https://medium.com/@slackhq/11-useful-tips-for-getting-the-most-of-slack-5dfb3d1af77
` `
func testAutoLink(env TestEnviroment) *model.AppError { func testAutoLink(env TestEnvironment) *model.AppError {
l4g.Info("Manual Auto Link Test") l4g.Info("Manual Auto Link Test")
channelID, err := getChannelID(model.DEFAULT_CHANNEL, env.CreatedTeamId, env.CreatedUserId) channelID, err := getChannelID(model.DEFAULT_CHANNEL, env.CreatedTeamId, env.CreatedUserId)
if err != true { if err != true {
......
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