diff options
author | Daniel Schalla <daniel@schalla.me> | 2018-09-03 14:08:40 +0200 |
---|---|---|
committer | Jesús Espino <jespinog@gmail.com> | 2018-09-03 14:08:40 +0200 |
commit | 531897b1f0d8176c1f983f921f1d1de618db0131 (patch) | |
tree | 0f01811eee640141b6a1959ed64a7b250fd59d47 /api4/post_test.go | |
parent | 68fdaaa995555e93f067efc3a07f1866e43ae665 (diff) | |
download | chat-531897b1f0d8176c1f983f921f1d1de618db0131.tar.gz chat-531897b1f0d8176c1f983f921f1d1de618db0131.tar.bz2 chat-531897b1f0d8176c1f983f921f1d1de618db0131.zip |
add megacheck as makefile target (#9288)
Fix code issues in channel_test.go
Fix Channel Test Issues detected by Megacheck
Fix API Emoji Test Issues detected by Megacheck
Fixed API Issues Reported by Megacheck
Fixed App issues reported by megacheck
Remaining fixes
removed test added by mistake from old HEAD
gofmt
Store Fixes
simplified returns
Fix test for multi member channel delete
revert to delete unused function
Diffstat (limited to 'api4/post_test.go')
-rw-r--r-- | api4/post_test.go | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/api4/post_test.go b/api4/post_test.go index c428d3ab2..8ccd88a42 100644 --- a/api4/post_test.go +++ b/api4/post_test.go @@ -65,7 +65,7 @@ func TestCreatePost(t *testing.T) { CheckBadRequestStatus(t, resp) post2 := &model.Post{ChannelId: th.BasicChannel2.Id, Message: "zz" + model.NewId() + "a", CreateAt: 123} - rpost2, resp := Client.CreatePost(post2) + rpost2, _ := Client.CreatePost(post2) if rpost2.CreateAt == post2.CreateAt { t.Fatal("create at should not match") @@ -154,7 +154,7 @@ func TestCreatePostEphemeral(t *testing.T) { CheckUnauthorizedStatus(t, resp) Client = th.Client - rpost, resp = Client.CreatePostEphemeral(ephemeralPost) + _, resp = Client.CreatePostEphemeral(ephemeralPost) CheckForbiddenStatus(t, resp) } @@ -1023,22 +1023,22 @@ func TestGetFlaggedPostsForUser(t *testing.T) { Client.Logout() - rpl, resp = Client.GetFlaggedPostsForUserInChannel(user.Id, channel1.Id, 0, 10) + _, resp = Client.GetFlaggedPostsForUserInChannel(user.Id, channel1.Id, 0, 10) CheckUnauthorizedStatus(t, resp) - rpl, resp = Client.GetFlaggedPostsForUserInTeam(user.Id, team1.Id, 0, 10) + _, resp = Client.GetFlaggedPostsForUserInTeam(user.Id, team1.Id, 0, 10) CheckUnauthorizedStatus(t, resp) - rpl, resp = Client.GetFlaggedPostsForUser(user.Id, 0, 10) + _, resp = Client.GetFlaggedPostsForUser(user.Id, 0, 10) CheckUnauthorizedStatus(t, resp) - rpl, resp = th.SystemAdminClient.GetFlaggedPostsForUserInChannel(user.Id, channel1.Id, 0, 10) + _, resp = th.SystemAdminClient.GetFlaggedPostsForUserInChannel(user.Id, channel1.Id, 0, 10) CheckNoError(t, resp) - rpl, resp = th.SystemAdminClient.GetFlaggedPostsForUserInTeam(user.Id, team1.Id, 0, 10) + _, resp = th.SystemAdminClient.GetFlaggedPostsForUserInTeam(user.Id, team1.Id, 0, 10) CheckNoError(t, resp) - rpl, resp = th.SystemAdminClient.GetFlaggedPostsForUser(user.Id, 0, 10) + _, resp = th.SystemAdminClient.GetFlaggedPostsForUser(user.Id, 0, 10) CheckNoError(t, resp) } @@ -1153,25 +1153,25 @@ func TestGetPost(t *testing.T) { Client.RemoveUserFromChannel(th.BasicChannel.Id, th.BasicUser.Id) // Channel is public, should be able to read post - post, resp = Client.GetPost(th.BasicPost.Id, "") + _, resp = Client.GetPost(th.BasicPost.Id, "") CheckNoError(t, resp) privatePost := th.CreatePostWithClient(Client, th.BasicPrivateChannel) - post, resp = Client.GetPost(privatePost.Id, "") + _, resp = Client.GetPost(privatePost.Id, "") CheckNoError(t, resp) Client.RemoveUserFromChannel(th.BasicPrivateChannel.Id, th.BasicUser.Id) // Channel is private, should not be able to read post - post, resp = Client.GetPost(privatePost.Id, "") + _, resp = Client.GetPost(privatePost.Id, "") CheckForbiddenStatus(t, resp) Client.Logout() _, resp = Client.GetPost(model.NewId(), "") CheckUnauthorizedStatus(t, resp) - post, resp = th.SystemAdminClient.GetPost(th.BasicPost.Id, "") + _, resp = th.SystemAdminClient.GetPost(th.BasicPost.Id, "") CheckNoError(t, resp) } @@ -1267,7 +1267,7 @@ func TestGetPostThread(t *testing.T) { _, resp = Client.GetPostThread(model.NewId(), "") CheckUnauthorizedStatus(t, resp) - list, resp = th.SystemAdminClient.GetPostThread(th.BasicPost.Id, "") + _, resp = th.SystemAdminClient.GetPostThread(th.BasicPost.Id, "") CheckNoError(t, resp) } @@ -1351,12 +1351,13 @@ func TestSearchPosts(t *testing.T) { t.Fatal("wrong search") } - if posts, resp = Client.SearchPosts(th.BasicTeam.Id, "*", false); len(posts.Order) != 0 { + if posts, _ = Client.SearchPosts(th.BasicTeam.Id, "*", false); len(posts.Order) != 0 { t.Fatal("searching for just * shouldn't return any results") } posts, resp = Client.SearchPosts(th.BasicTeam.Id, "post1 post2", true) CheckNoError(t, resp) + if len(posts.Order) != 2 { t.Fatal("wrong search results") } |