summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-30 11:57:24 -0500
committerGitHub <noreply@github.com>2017-10-30 11:57:24 -0500
commitc5e8cb25caa39ed018ede5270e1566e8f7448396 (patch)
tree80f9f8957d4ff8458ecf9631135c916df25544bd /api4
parent63df41b91110bac06baffef87fe0c1952b47ac93 (diff)
downloadchat-c5e8cb25caa39ed018ede5270e1566e8f7448396.tar.gz
chat-c5e8cb25caa39ed018ede5270e1566e8f7448396.tar.bz2
chat-c5e8cb25caa39ed018ede5270e1566e8f7448396.zip
simplify things (#7735)
Diffstat (limited to 'api4')
-rw-r--r--api4/channel.go2
-rw-r--r--api4/emoji_test.go6
-rw-r--r--api4/file_test.go6
-rw-r--r--api4/post_test.go12
-rw-r--r--api4/system_test.go8
-rw-r--r--api4/team.go1
-rw-r--r--api4/team_test.go10
-rw-r--r--api4/user_test.go6
8 files changed, 24 insertions, 27 deletions
diff --git a/api4/channel.go b/api4/channel.go
index 84d64b1a9..5a3920a0a 100644
--- a/api4/channel.go
+++ b/api4/channel.go
@@ -322,7 +322,6 @@ func getChannel(c *Context, w http.ResponseWriter, r *http.Request) {
}
w.Write([]byte(channel.ToJson()))
- return
}
func getChannelUnread(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -601,7 +600,6 @@ func getChannelByNameForTeamName(c *Context, w http.ResponseWriter, r *http.Requ
}
w.Write([]byte(channel.ToJson()))
- return
}
func getChannelMembers(c *Context, w http.ResponseWriter, r *http.Request) {
diff --git a/api4/emoji_test.go b/api4/emoji_test.go
index e35abdf08..32492b704 100644
--- a/api4/emoji_test.go
+++ b/api4/emoji_test.go
@@ -127,7 +127,7 @@ func TestCreateEmoji(t *testing.T) {
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)
CheckErrorMessage(t, resp, "api.emoji.upload.image.app_error")
@@ -232,7 +232,7 @@ func TestDeleteEmoji(t *testing.T) {
ok, resp := Client.DeleteEmoji(newEmoji.Id)
CheckNoError(t, resp)
- if ok != true {
+ if !ok {
t.Fatal("should return true")
} else {
_, err := Client.GetEmoji(newEmoji.Id)
@@ -247,7 +247,7 @@ func TestDeleteEmoji(t *testing.T) {
ok, resp = th.SystemAdminClient.DeleteEmoji(newEmoji.Id)
CheckNoError(t, resp)
- if ok != true {
+ if !ok {
t.Fatal("should return true")
} else {
_, err := th.SystemAdminClient.GetEmoji(newEmoji.Id)
diff --git a/api4/file_test.go b/api4/file_test.go
index 0d44f2c86..394406d6e 100644
--- a/api4/file_test.go
+++ b/api4/file_test.go
@@ -151,7 +151,7 @@ func TestGetFile(t *testing.T) {
data, resp := Client.GetFile(fileId)
CheckNoError(t, resp)
- if data == nil || len(data) == 0 {
+ if len(data) == 0 {
t.Fatal("should not be empty")
}
@@ -268,7 +268,7 @@ func TestGetFileThumbnail(t *testing.T) {
data, resp := Client.GetFileThumbnail(fileId)
CheckNoError(t, resp)
- if data == nil || len(data) == 0 {
+ if len(data) == 0 {
t.Fatal("should not be empty")
}
@@ -395,7 +395,7 @@ func TestGetFilePreview(t *testing.T) {
data, resp := Client.GetFilePreview(fileId)
CheckNoError(t, resp)
- if data == nil || len(data) == 0 {
+ if len(data) == 0 {
t.Fatal("should not be empty")
}
diff --git a/api4/post_test.go b/api4/post_test.go
index 054c9fc06..6f195296a 100644
--- a/api4/post_test.go
+++ b/api4/post_test.go
@@ -572,7 +572,7 @@ func TestPatchPost(t *testing.T) {
rpost, resp := Client.PatchPost(post.Id, patch)
CheckNoError(t, resp)
- if rpost.IsPinned != false {
+ if rpost.IsPinned {
t.Fatal("IsPinned did not update properly")
}
if rpost.Message != "#otherhashtag other message" {
@@ -593,7 +593,7 @@ func TestPatchPost(t *testing.T) {
if !reflect.DeepEqual(rpost.FileIds, *patch.FileIds) {
t.Fatal("FileIds did not update properly")
}
- if rpost.HasReactions != false {
+ if rpost.HasReactions {
t.Fatal("HasReactions did not update properly")
}
@@ -642,7 +642,7 @@ func TestPinPost(t *testing.T) {
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")
}
@@ -677,7 +677,7 @@ func TestUnpinPost(t *testing.T) {
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")
}
@@ -1157,7 +1157,7 @@ func TestDeletePost(t *testing.T) {
CheckUnauthorizedStatus(t, resp)
status, resp := th.SystemAdminClient.DeletePost(post.Id)
- if status == false {
+ if !status {
t.Fatal("post should return status OK")
}
CheckNoError(t, resp)
@@ -1443,7 +1443,7 @@ func TestGetFileInfosForPost(t *testing.T) {
defer th.TearDown()
Client := th.Client
- fileIds := make([]string, 3, 3)
+ fileIds := make([]string, 3)
if data, err := readTestFile("test.png"); err != nil {
t.Fatal(err)
} else {
diff --git a/api4/system_test.go b/api4/system_test.go
index 1677d5724..3afcf633c 100644
--- a/api4/system_test.go
+++ b/api4/system_test.go
@@ -87,13 +87,13 @@ func TestReloadConfig(t *testing.T) {
flag, resp := Client.ReloadConfig()
CheckForbiddenStatus(t, resp)
- if flag == true {
+ if flag {
t.Fatal("should not Reload the config due no permission.")
}
flag, resp = th.SystemAdminClient.ReloadConfig()
CheckNoError(t, resp)
- if flag == false {
+ if !flag {
t.Fatal("should Reload the config")
}
@@ -285,13 +285,13 @@ func TestInvalidateCaches(t *testing.T) {
flag, resp := Client.InvalidateCaches()
CheckForbiddenStatus(t, resp)
- if flag == true {
+ if flag {
t.Fatal("should not clean the cache due no permission.")
}
flag, resp = th.SystemAdminClient.InvalidateCaches()
CheckNoError(t, resp)
- if flag == false {
+ if !flag {
t.Fatal("should clean the cache")
}
}
diff --git a/api4/team.go b/api4/team.go
index ea39629c7..58dcaca0d 100644
--- a/api4/team.go
+++ b/api4/team.go
@@ -604,7 +604,6 @@ func teamExists(c *Context, w http.ResponseWriter, r *http.Request) {
}
w.Write([]byte(model.MapBoolToJson(resp)))
- return
}
func importTeam(c *Context, w http.ResponseWriter, r *http.Request) {
diff --git a/api4/team_test.go b/api4/team_test.go
index 544fa6157..da2f42369 100644
--- a/api4/team_test.go
+++ b/api4/team_test.go
@@ -282,7 +282,7 @@ func TestUpdateTeam(t *testing.T) {
uteam, resp = Client.UpdateTeam(team)
CheckNoError(t, resp)
- if uteam.AllowOpenInvite != true {
+ if !uteam.AllowOpenInvite {
t.Fatal("Update failed")
}
@@ -419,7 +419,7 @@ func TestPatchTeam(t *testing.T) {
if rteam.InviteId != "inviteid1" {
t.Fatal("InviteId did not update properly")
}
- if rteam.AllowOpenInvite != true {
+ if !rteam.AllowOpenInvite {
t.Fatal("AllowOpenInvite did not update properly")
}
@@ -1780,13 +1780,13 @@ func TestTeamExists(t *testing.T) {
exists, resp := Client.TeamExists(team.Name, "")
CheckNoError(t, resp)
- if exists != true {
+ if !exists {
t.Fatal("team should exist")
}
exists, resp = Client.TeamExists("testingteam", "")
CheckNoError(t, resp)
- if exists != false {
+ if exists {
t.Fatal("team should not exist")
}
@@ -1889,7 +1889,7 @@ func TestInviteUsersToTeam(t *testing.T) {
okMsg, resp := th.SystemAdminClient.InviteUsersToTeam(th.BasicTeam.Id, emailList)
CheckNoError(t, resp)
- if okMsg != true {
+ if !okMsg {
t.Fatal("should return true")
}
diff --git a/api4/user_test.go b/api4/user_test.go
index 5424a1ee2..0121c71af 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -821,7 +821,7 @@ func TestGetProfileImage(t *testing.T) {
data, resp := Client.GetProfileImage(user.Id, "")
CheckNoError(t, resp)
- if data == nil || len(data) == 0 {
+ if len(data) == 0 {
t.Fatal("Should not be empty")
}
@@ -1860,7 +1860,7 @@ func TestRevokeSessions(t *testing.T) {
CheckBadRequestStatus(t, resp)
status, resp := Client.RevokeSession(user.Id, session.Id)
- if status == false {
+ if !status {
t.Fatal("user session revoke unsuccessful")
}
CheckNoError(t, resp)
@@ -1912,7 +1912,7 @@ func TestRevokeAllSessions(t *testing.T) {
CheckBadRequestStatus(t, resp)
status, resp := Client.RevokeAllSessions(user.Id)
- if status == false {
+ if !status {
t.Fatal("user all sessions revoke unsuccessful")
}
CheckNoError(t, resp)