Unverified Commit c5e8cb25 authored by Chris's avatar Chris Committed by GitHub

simplify things (#7735)

parent 63df41b9
...@@ -206,7 +206,7 @@ func TestCreateEmoji(t *testing.T) { ...@@ -206,7 +206,7 @@ func TestCreateEmoji(t *testing.T) {
CreatorId: th.BasicUser.Id, CreatorId: th.BasicUser.Id,
Name: model.NewId(), Name: model.NewId(),
} }
if _, err := Client.CreateEmoji(emoji, make([]byte, 100, 100), "image.gif"); err == nil { if _, err := Client.CreateEmoji(emoji, make([]byte, 100), "image.gif"); err == nil {
t.Fatal("shouldn't be able to create an emoji with non-image data") t.Fatal("shouldn't be able to create an emoji with non-image data")
} }
......
...@@ -1321,7 +1321,7 @@ func TestGetFileInfosForPost(t *testing.T) { ...@@ -1321,7 +1321,7 @@ func TestGetFileInfosForPost(t *testing.T) {
Client := th.BasicClient Client := th.BasicClient
channel1 := th.BasicChannel channel1 := th.BasicChannel
fileIds := make([]string, 3, 3) fileIds := make([]string, 3)
if data, err := readTestFile("test.png"); err != nil { if data, err := readTestFile("test.png"); err != nil {
t.Fatal(err) t.Fatal(err)
} else { } else {
...@@ -1531,7 +1531,7 @@ func TestPinPost(t *testing.T) { ...@@ -1531,7 +1531,7 @@ func TestPinPost(t *testing.T) {
if rupost1, err := Client.PinPost(post.ChannelId, post.Id); err != nil { if rupost1, err := Client.PinPost(post.ChannelId, post.Id); err != nil {
t.Fatal(err) t.Fatal(err)
} else { } else {
if rupost1.Data.(*model.Post).IsPinned != true { if !rupost1.Data.(*model.Post).IsPinned {
t.Fatal("failed to pin post") t.Fatal("failed to pin post")
} }
} }
...@@ -1540,7 +1540,7 @@ func TestPinPost(t *testing.T) { ...@@ -1540,7 +1540,7 @@ func TestPinPost(t *testing.T) {
if rupost2, err := Client.PinPost(pinnedPost.ChannelId, pinnedPost.Id); err != nil { if rupost2, err := Client.PinPost(pinnedPost.ChannelId, pinnedPost.Id); err != nil {
t.Fatal(err) t.Fatal(err)
} else { } else {
if rupost2.Data.(*model.Post).IsPinned != true { if !rupost2.Data.(*model.Post).IsPinned {
t.Fatal("pinning a post should be idempotent") t.Fatal("pinning a post should be idempotent")
} }
} }
...@@ -1556,7 +1556,7 @@ func TestUnpinPost(t *testing.T) { ...@@ -1556,7 +1556,7 @@ func TestUnpinPost(t *testing.T) {
if rupost1, err := Client.UnpinPost(pinnedPost.ChannelId, pinnedPost.Id); err != nil { if rupost1, err := Client.UnpinPost(pinnedPost.ChannelId, pinnedPost.Id); err != nil {
t.Fatal(err) t.Fatal(err)
} else { } else {
if rupost1.Data.(*model.Post).IsPinned != false { if rupost1.Data.(*model.Post).IsPinned {
t.Fatal("failed to unpin post") t.Fatal("failed to unpin post")
} }
} }
...@@ -1565,7 +1565,7 @@ func TestUnpinPost(t *testing.T) { ...@@ -1565,7 +1565,7 @@ func TestUnpinPost(t *testing.T) {
if rupost2, err := Client.UnpinPost(post.ChannelId, post.Id); err != nil { if rupost2, err := Client.UnpinPost(post.ChannelId, post.Id); err != nil {
t.Fatal(err) t.Fatal(err)
} else { } else {
if rupost2.Data.(*model.Post).IsPinned != false { if rupost2.Data.(*model.Post).IsPinned {
t.Fatal("unpinning a post should be idempotent") t.Fatal("unpinning a post should be idempotent")
} }
} }
......
...@@ -1167,7 +1167,6 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -1167,7 +1167,6 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
c.App.AddDirectChannels(teamId, user) c.App.AddDirectChannels(teamId, user)
}) })
} }
break
case model.OAUTH_ACTION_EMAIL_TO_SSO: case model.OAUTH_ACTION_EMAIL_TO_SSO:
if err := c.App.RevokeAllSessions(user.Id); err != nil { if err := c.App.RevokeAllSessions(user.Id); err != nil {
c.Err = err c.Err = err
...@@ -1179,7 +1178,6 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -1179,7 +1178,6 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
l4g.Error(err.Error()) l4g.Error(err.Error())
} }
}) })
break
} }
doLogin(c, w, r, user, "") doLogin(c, w, r, user, "")
if c.Err != nil { if c.Err != nil {
......
...@@ -322,7 +322,6 @@ func getChannel(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -322,7 +322,6 @@ func getChannel(c *Context, w http.ResponseWriter, r *http.Request) {
} }
w.Write([]byte(channel.ToJson())) w.Write([]byte(channel.ToJson()))
return
} }
func getChannelUnread(c *Context, w http.ResponseWriter, r *http.Request) { func getChannelUnread(c *Context, w http.ResponseWriter, r *http.Request) {
...@@ -601,7 +600,6 @@ func getChannelByNameForTeamName(c *Context, w http.ResponseWriter, r *http.Requ ...@@ -601,7 +600,6 @@ func getChannelByNameForTeamName(c *Context, w http.ResponseWriter, r *http.Requ
} }
w.Write([]byte(channel.ToJson())) w.Write([]byte(channel.ToJson()))
return
} }
func getChannelMembers(c *Context, w http.ResponseWriter, r *http.Request) { func getChannelMembers(c *Context, w http.ResponseWriter, r *http.Request) {
......
...@@ -127,7 +127,7 @@ func TestCreateEmoji(t *testing.T) { ...@@ -127,7 +127,7 @@ func TestCreateEmoji(t *testing.T) {
Name: model.NewId(), Name: model.NewId(),
} }
_, resp = Client.CreateEmoji(emoji, make([]byte, 100, 100), "image.gif") _, resp = Client.CreateEmoji(emoji, make([]byte, 100), "image.gif")
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
CheckErrorMessage(t, resp, "api.emoji.upload.image.app_error") CheckErrorMessage(t, resp, "api.emoji.upload.image.app_error")
...@@ -232,7 +232,7 @@ func TestDeleteEmoji(t *testing.T) { ...@@ -232,7 +232,7 @@ func TestDeleteEmoji(t *testing.T) {
ok, resp := Client.DeleteEmoji(newEmoji.Id) ok, resp := Client.DeleteEmoji(newEmoji.Id)
CheckNoError(t, resp) CheckNoError(t, resp)
if ok != true { if !ok {
t.Fatal("should return true") t.Fatal("should return true")
} else { } else {
_, err := Client.GetEmoji(newEmoji.Id) _, err := Client.GetEmoji(newEmoji.Id)
...@@ -247,7 +247,7 @@ func TestDeleteEmoji(t *testing.T) { ...@@ -247,7 +247,7 @@ func TestDeleteEmoji(t *testing.T) {
ok, resp = th.SystemAdminClient.DeleteEmoji(newEmoji.Id) ok, resp = th.SystemAdminClient.DeleteEmoji(newEmoji.Id)
CheckNoError(t, resp) CheckNoError(t, resp)
if ok != true { if !ok {
t.Fatal("should return true") t.Fatal("should return true")
} else { } else {
_, err := th.SystemAdminClient.GetEmoji(newEmoji.Id) _, err := th.SystemAdminClient.GetEmoji(newEmoji.Id)
......
...@@ -151,7 +151,7 @@ func TestGetFile(t *testing.T) { ...@@ -151,7 +151,7 @@ func TestGetFile(t *testing.T) {
data, resp := Client.GetFile(fileId) data, resp := Client.GetFile(fileId)
CheckNoError(t, resp) CheckNoError(t, resp)
if data == nil || len(data) == 0 { if len(data) == 0 {
t.Fatal("should not be empty") t.Fatal("should not be empty")
} }
...@@ -268,7 +268,7 @@ func TestGetFileThumbnail(t *testing.T) { ...@@ -268,7 +268,7 @@ func TestGetFileThumbnail(t *testing.T) {
data, resp := Client.GetFileThumbnail(fileId) data, resp := Client.GetFileThumbnail(fileId)
CheckNoError(t, resp) CheckNoError(t, resp)
if data == nil || len(data) == 0 { if len(data) == 0 {
t.Fatal("should not be empty") t.Fatal("should not be empty")
} }
...@@ -395,7 +395,7 @@ func TestGetFilePreview(t *testing.T) { ...@@ -395,7 +395,7 @@ func TestGetFilePreview(t *testing.T) {
data, resp := Client.GetFilePreview(fileId) data, resp := Client.GetFilePreview(fileId)
CheckNoError(t, resp) CheckNoError(t, resp)
if data == nil || len(data) == 0 { if len(data) == 0 {
t.Fatal("should not be empty") t.Fatal("should not be empty")
} }
......
...@@ -572,7 +572,7 @@ func TestPatchPost(t *testing.T) { ...@@ -572,7 +572,7 @@ func TestPatchPost(t *testing.T) {
rpost, resp := Client.PatchPost(post.Id, patch) rpost, resp := Client.PatchPost(post.Id, patch)
CheckNoError(t, resp) CheckNoError(t, resp)
if rpost.IsPinned != false { if rpost.IsPinned {
t.Fatal("IsPinned did not update properly") t.Fatal("IsPinned did not update properly")
} }
if rpost.Message != "#otherhashtag other message" { if rpost.Message != "#otherhashtag other message" {
...@@ -593,7 +593,7 @@ func TestPatchPost(t *testing.T) { ...@@ -593,7 +593,7 @@ func TestPatchPost(t *testing.T) {
if !reflect.DeepEqual(rpost.FileIds, *patch.FileIds) { if !reflect.DeepEqual(rpost.FileIds, *patch.FileIds) {
t.Fatal("FileIds did not update properly") t.Fatal("FileIds did not update properly")
} }
if rpost.HasReactions != false { if rpost.HasReactions {
t.Fatal("HasReactions did not update properly") t.Fatal("HasReactions did not update properly")
} }
...@@ -642,7 +642,7 @@ func TestPinPost(t *testing.T) { ...@@ -642,7 +642,7 @@ func TestPinPost(t *testing.T) {
t.Fatal("should have passed") t.Fatal("should have passed")
} }
if rpost, err := th.App.GetSinglePost(post.Id); err != nil && rpost.IsPinned != true { if rpost, err := th.App.GetSinglePost(post.Id); err != nil && !rpost.IsPinned {
t.Fatal("failed to pin post") t.Fatal("failed to pin post")
} }
...@@ -677,7 +677,7 @@ func TestUnpinPost(t *testing.T) { ...@@ -677,7 +677,7 @@ func TestUnpinPost(t *testing.T) {
t.Fatal("should have passed") t.Fatal("should have passed")
} }
if rpost, err := th.App.GetSinglePost(pinnedPost.Id); err != nil && rpost.IsPinned != false { if rpost, err := th.App.GetSinglePost(pinnedPost.Id); err != nil && rpost.IsPinned {
t.Fatal("failed to pin post") t.Fatal("failed to pin post")
} }
...@@ -1157,7 +1157,7 @@ func TestDeletePost(t *testing.T) { ...@@ -1157,7 +1157,7 @@ func TestDeletePost(t *testing.T) {
CheckUnauthorizedStatus(t, resp) CheckUnauthorizedStatus(t, resp)
status, resp := th.SystemAdminClient.DeletePost(post.Id) status, resp := th.SystemAdminClient.DeletePost(post.Id)
if status == false { if !status {
t.Fatal("post should return status OK") t.Fatal("post should return status OK")
} }
CheckNoError(t, resp) CheckNoError(t, resp)
...@@ -1443,7 +1443,7 @@ func TestGetFileInfosForPost(t *testing.T) { ...@@ -1443,7 +1443,7 @@ func TestGetFileInfosForPost(t *testing.T) {
defer th.TearDown() defer th.TearDown()
Client := th.Client Client := th.Client
fileIds := make([]string, 3, 3) fileIds := make([]string, 3)
if data, err := readTestFile("test.png"); err != nil { if data, err := readTestFile("test.png"); err != nil {
t.Fatal(err) t.Fatal(err)
} else { } else {
......
...@@ -87,13 +87,13 @@ func TestReloadConfig(t *testing.T) { ...@@ -87,13 +87,13 @@ func TestReloadConfig(t *testing.T) {
flag, resp := Client.ReloadConfig() flag, resp := Client.ReloadConfig()
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
if flag == true { if flag {
t.Fatal("should not Reload the config due no permission.") t.Fatal("should not Reload the config due no permission.")
} }
flag, resp = th.SystemAdminClient.ReloadConfig() flag, resp = th.SystemAdminClient.ReloadConfig()
CheckNoError(t, resp) CheckNoError(t, resp)
if flag == false { if !flag {
t.Fatal("should Reload the config") t.Fatal("should Reload the config")
} }
...@@ -285,13 +285,13 @@ func TestInvalidateCaches(t *testing.T) { ...@@ -285,13 +285,13 @@ func TestInvalidateCaches(t *testing.T) {
flag, resp := Client.InvalidateCaches() flag, resp := Client.InvalidateCaches()
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
if flag == true { if flag {
t.Fatal("should not clean the cache due no permission.") t.Fatal("should not clean the cache due no permission.")
} }
flag, resp = th.SystemAdminClient.InvalidateCaches() flag, resp = th.SystemAdminClient.InvalidateCaches()
CheckNoError(t, resp) CheckNoError(t, resp)
if flag == false { if !flag {
t.Fatal("should clean the cache") t.Fatal("should clean the cache")
} }
} }
......
...@@ -604,7 +604,6 @@ func teamExists(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -604,7 +604,6 @@ func teamExists(c *Context, w http.ResponseWriter, r *http.Request) {
} }
w.Write([]byte(model.MapBoolToJson(resp))) w.Write([]byte(model.MapBoolToJson(resp)))
return
} }
func importTeam(c *Context, w http.ResponseWriter, r *http.Request) { func importTeam(c *Context, w http.ResponseWriter, r *http.Request) {
......
...@@ -282,7 +282,7 @@ func TestUpdateTeam(t *testing.T) { ...@@ -282,7 +282,7 @@ func TestUpdateTeam(t *testing.T) {
uteam, resp = Client.UpdateTeam(team) uteam, resp = Client.UpdateTeam(team)
CheckNoError(t, resp) CheckNoError(t, resp)
if uteam.AllowOpenInvite != true { if !uteam.AllowOpenInvite {
t.Fatal("Update failed") t.Fatal("Update failed")
} }
...@@ -419,7 +419,7 @@ func TestPatchTeam(t *testing.T) { ...@@ -419,7 +419,7 @@ func TestPatchTeam(t *testing.T) {
if rteam.InviteId != "inviteid1" { if rteam.InviteId != "inviteid1" {
t.Fatal("InviteId did not update properly") t.Fatal("InviteId did not update properly")
} }
if rteam.AllowOpenInvite != true { if !rteam.AllowOpenInvite {
t.Fatal("AllowOpenInvite did not update properly") t.Fatal("AllowOpenInvite did not update properly")
} }
...@@ -1780,13 +1780,13 @@ func TestTeamExists(t *testing.T) { ...@@ -1780,13 +1780,13 @@ func TestTeamExists(t *testing.T) {
exists, resp := Client.TeamExists(team.Name, "") exists, resp := Client.TeamExists(team.Name, "")
CheckNoError(t, resp) CheckNoError(t, resp)
if exists != true { if !exists {
t.Fatal("team should exist") t.Fatal("team should exist")
} }
exists, resp = Client.TeamExists("testingteam", "") exists, resp = Client.TeamExists("testingteam", "")
CheckNoError(t, resp) CheckNoError(t, resp)
if exists != false { if exists {
t.Fatal("team should not exist") t.Fatal("team should not exist")
} }
...@@ -1889,7 +1889,7 @@ func TestInviteUsersToTeam(t *testing.T) { ...@@ -1889,7 +1889,7 @@ func TestInviteUsersToTeam(t *testing.T) {
okMsg, resp := th.SystemAdminClient.InviteUsersToTeam(th.BasicTeam.Id, emailList) okMsg, resp := th.SystemAdminClient.InviteUsersToTeam(th.BasicTeam.Id, emailList)
CheckNoError(t, resp) CheckNoError(t, resp)
if okMsg != true { if !okMsg {
t.Fatal("should return true") t.Fatal("should return true")
} }
......
...@@ -821,7 +821,7 @@ func TestGetProfileImage(t *testing.T) { ...@@ -821,7 +821,7 @@ func TestGetProfileImage(t *testing.T) {
data, resp := Client.GetProfileImage(user.Id, "") data, resp := Client.GetProfileImage(user.Id, "")
CheckNoError(t, resp) CheckNoError(t, resp)
if data == nil || len(data) == 0 { if len(data) == 0 {
t.Fatal("Should not be empty") t.Fatal("Should not be empty")
} }
...@@ -1860,7 +1860,7 @@ func TestRevokeSessions(t *testing.T) { ...@@ -1860,7 +1860,7 @@ func TestRevokeSessions(t *testing.T) {
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
status, resp := Client.RevokeSession(user.Id, session.Id) status, resp := Client.RevokeSession(user.Id, session.Id)
if status == false { if !status {
t.Fatal("user session revoke unsuccessful") t.Fatal("user session revoke unsuccessful")
} }
CheckNoError(t, resp) CheckNoError(t, resp)
...@@ -1912,7 +1912,7 @@ func TestRevokeAllSessions(t *testing.T) { ...@@ -1912,7 +1912,7 @@ func TestRevokeAllSessions(t *testing.T) {
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
status, resp := Client.RevokeAllSessions(user.Id) status, resp := Client.RevokeAllSessions(user.Id)
if status == false { if !status {
t.Fatal("user all sessions revoke unsuccessful") t.Fatal("user all sessions revoke unsuccessful")
} }
CheckNoError(t, resp) CheckNoError(t, resp)
......
...@@ -65,7 +65,7 @@ func (cfg *AutoChannelCreator) CreateTestChannels(num utils.Range) ([]*model.Cha ...@@ -65,7 +65,7 @@ func (cfg *AutoChannelCreator) CreateTestChannels(num utils.Range) ([]*model.Cha
for i := 0; i < numChannels; i++ { for i := 0; i < numChannels; i++ {
var err bool var err bool
channels[i], err = cfg.createRandomChannel() channels[i], err = cfg.createRandomChannel()
if err != true { if !err {
return channels, false return channels, false
} }
} }
......
...@@ -22,7 +22,7 @@ func CreateTestEnvironmentWithTeams(a *App, client *model.Client, rangeTeams uti ...@@ -22,7 +22,7 @@ func CreateTestEnvironmentWithTeams(a *App, client *model.Client, rangeTeams uti
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 {
return TestEnvironment{}, false return TestEnvironment{}, false
} }
...@@ -32,13 +32,13 @@ func CreateTestEnvironmentWithTeams(a *App, client *model.Client, rangeTeams uti ...@@ -32,13 +32,13 @@ func CreateTestEnvironmentWithTeams(a *App, client *model.Client, rangeTeams uti
userCreator := NewAutoUserCreator(a, client, team) userCreator := NewAutoUserCreator(a, client, team)
userCreator.Fuzzy = fuzzy userCreator.Fuzzy = fuzzy
randomUser, err := userCreator.createRandomUser() randomUser, err := userCreator.createRandomUser()
if err != true { if !err {
return TestEnvironment{}, false return TestEnvironment{}, false
} }
client.LoginById(randomUser.Id, USER_PASSWORD) client.LoginById(randomUser.Id, USER_PASSWORD)
client.SetTeamId(team.Id) client.SetTeamId(team.Id)
teamEnvironment, err := CreateTestEnvironmentInTeam(a, client, team, rangeChannels, rangeUsers, rangePosts, fuzzy) teamEnvironment, err := CreateTestEnvironmentInTeam(a, client, team, rangeChannels, rangeUsers, rangePosts, fuzzy)
if err != true { if !err {
return TestEnvironment{}, false return TestEnvironment{}, false
} }
environment.Environments[i] = teamEnvironment environment.Environments[i] = teamEnvironment
...@@ -58,7 +58,7 @@ func CreateTestEnvironmentInTeam(a *App, client *model.Client, team *model.Team, ...@@ -58,7 +58,7 @@ func CreateTestEnvironmentInTeam(a *App, client *model.Client, team *model.Team,
userCreator := NewAutoUserCreator(a, client, team) userCreator := NewAutoUserCreator(a, client, team)
userCreator.Fuzzy = fuzzy userCreator.Fuzzy = fuzzy
users, err := userCreator.CreateTestUsers(rangeUsers) users, err := userCreator.CreateTestUsers(rangeUsers)
if err != true { if !err {
return TeamEnvironment{}, false return TeamEnvironment{}, false
} }
usernames := make([]string, len(users)) usernames := make([]string, len(users))
...@@ -78,7 +78,7 @@ func CreateTestEnvironmentInTeam(a *App, client *model.Client, team *model.Team, ...@@ -78,7 +78,7 @@ func CreateTestEnvironmentInTeam(a *App, client *model.Client, team *model.Team,
} }
} }
if err != true { if !err {
return TeamEnvironment{}, false return TeamEnvironment{}, false
} }
......
...@@ -65,7 +65,7 @@ func (cfg *AutoPostCreator) CreateRandomPost() (*model.Post, bool) { ...@@ -65,7 +65,7 @@ func (cfg *AutoPostCreator) CreateRandomPost() (*model.Post, bool) {
if cfg.HasImage { if cfg.HasImage {
var err1 bool var err1 bool
fileIds, err1 = cfg.UploadTestFile() fileIds, err1 = cfg.UploadTestFile()
if err1 == false { if !err1 {
return nil, false return nil, false
} }
} }
...@@ -95,7 +95,7 @@ func (cfg *AutoPostCreator) CreateTestPosts(rangePosts utils.Range) ([]*model.Po ...@@ -95,7 +95,7 @@ func (cfg *AutoPostCreator) CreateTestPosts(rangePosts utils.Range) ([]*model.Po
for i := 0; i < numPosts; i++ { for i := 0; i < numPosts; i++ {
var err bool var err bool
posts[i], err = cfg.CreateRandomPost() posts[i], err = cfg.CreateRandomPost()
if err != true { if !err {
return posts, false return posts, false
} }
} }
......
...@@ -72,7 +72,7 @@ func (cfg *AutoTeamCreator) CreateTestTeams(num utils.Range) ([]*model.Team, boo ...@@ -72,7 +72,7 @@ func (cfg *AutoTeamCreator) CreateTestTeams(num utils.Range) ([]*model.Team, boo
for i := 0; i < numTeams; i++ { for i := 0; i < numTeams; i++ {
var err bool var err bool
teams[i], err = cfg.createRandomTeam() teams[i], err = cfg.createRandomTeam()
if err != true { if !err {
return teams, false return teams, false
} }
} }
......
...@@ -38,7 +38,7 @@ func NewAutoUserCreator(a *App, client *model.Client, team *model.Team) *AutoUse ...@@ -38,7 +38,7 @@ func NewAutoUserCreator(a *App, client *model.Client, team *model.Team) *AutoUse
// Basic test team and user so you always know one // Basic test team and user so you always know one
func (a *App) CreateBasicUser(client *model.Client) *model.AppError { func (a *App) CreateBasicUser(client *model.Client) *model.AppError {
result, _ := client.FindTeamByName(BTEST_TEAM_NAME) result, _ := client.FindTeamByName(BTEST_TEAM_NAME)
if result.Data.(bool) == false { if !result.Data.(bool) {
newteam := &model.Team{DisplayName: BTEST_TEAM_DISPLAY_NAME, Name: BTEST_TEAM_NAME, Email: BTEST_TEAM_EMAIL, Type: BTEST_TEAM_TYPE} newteam := &model.Team{DisplayName: BTEST_TEAM_DISPLAY_NAME, Name: BTEST_TEAM_NAME, Email: BTEST_TEAM_EMAIL, Type: BTEST_TEAM_TYPE}
result, err := client.CreateTeam(newteam) result, err := client.CreateTeam(newteam)
if err != nil { if err != nil {
...@@ -102,7 +102,7 @@ func (cfg *AutoUserCreator) CreateTestUsers(num utils.Range) ([]*model.User, boo ...@@ -102,7 +102,7 @@ func (cfg *AutoUserCreator) CreateTestUsers(num utils.Range) ([]*model.User, boo
for i := 0; i < numUsers; i++ { for i := 0; i < numUsers; i++ {
var err bool var err bool
users[i], err = cfg.createRandomUser() users[i], err = cfg.createRandomUser()
if err != true { if !err {
return users, false return users, false
} }
} }
......
...@@ -53,7 +53,7 @@ func (me *EchoProvider) DoCommand(a *App, args *model.CommandArgs, message strin ...@@ -53,7 +53,7 @@ func (me *EchoProvider) DoCommand(a *App, args *model.CommandArgs, message strin
delay = checkDelay delay = checkDelay
} }
message = message[1:endMsg] message = message[1:endMsg]
} else if strings.Index(message, " ") > -1 { } else if strings.Contains(message, " ") {
delayIdx := strings.LastIndex(message, " ") delayIdx := strings.LastIndex(message, " ")
delayStr := strings.Trim(message[delayIdx:], " ") delayStr := strings.Trim(message[delayIdx:], " ")
......
...@@ -173,7 +173,7 @@ func (me *LoadTestProvider) SetupCommand(a *App, args *model.CommandArgs, messag ...@@ -173,7 +173,7 @@ func (me *LoadTestProvider) SetupCommand(a *App, args *model.CommandArgs, messag
utils.Range{Begin: numUsers, End: numUsers}, utils.Range{Begin: numUsers, End: numUsers},
utils.Range{Begin: numPosts, End: numPosts}, utils.Range{Begin: numPosts, End: numPosts},
doFuzz) doFuzz)
if err != true { if !err {
return &model.CommandResponse{Text: "Failed to create testing environment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} return &model.CommandResponse{Text: "Failed to create testing environment", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
} else { } else {
l4g.Info("Testing environment created") l4g.Info("Testing environment created")
...@@ -216,7 +216,7 @@ func (me *LoadTestProvider) UsersCommand(a *App, args *model.CommandArgs, messag ...@@ -216,7 +216,7 @@ func (me *LoadTestProvider) UsersCommand(a *App, args *model.CommandArgs, messag
} }
usersr, err := parseRange(cmd, "") usersr, err := parseRange(cmd, "")
if err == false { if !err {
usersr = utils.Range{Begin: 2, End: 5} usersr = utils.Range{Begin: 2, End: 5}
} }
...@@ -246,7 +246,7 @@ func (me *LoadTestProvider) ChannelsCommand(a *App, args *model.CommandArgs, mes ...@@ -246,7 +246,7 @@ func (me *LoadTestProvider) ChannelsCommand(a *App, args *model.CommandArgs, mes
} }
channelsr, err := parseRange(cmd, "") channelsr, err := parseRange(cmd, "")
if err == false { if !err {
channelsr = utils.Range{Begin: 2, End: 5}