diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-07-17 10:21:16 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-07-17 10:21:16 -0400 |
commit | dcc2173f1f46cb2b0958ff5f6e1df941f1650e54 (patch) | |
tree | 0069eb347b9604d8f2faff919380eca24175f1da /api/post_test.go | |
parent | 05d6a3a8128ea9b901a3f6eba0bd048b0464a390 (diff) | |
parent | 372869354f8c4480f39c67348694ca2192747b6d (diff) | |
download | chat-dcc2173f1f46cb2b0958ff5f6e1df941f1650e54.tar.gz chat-dcc2173f1f46cb2b0958ff5f6e1df941f1650e54.tar.bz2 chat-dcc2173f1f46cb2b0958ff5f6e1df941f1650e54.zip |
Merge pull request #184 from nickago/MM-1278
MM-1278 Team admin can now delete any post
Diffstat (limited to 'api/post_test.go')
-rw-r--r-- | api/post_test.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/api/post_test.go b/api/post_test.go index 970307759..5009ff54d 100644 --- a/api/post_test.go +++ b/api/post_test.go @@ -483,6 +483,10 @@ func TestDeletePosts(t *testing.T) { team := &model.Team{Name: "Name", Domain: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN} team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team) + userAdmin := &model.User{TeamId: team.Id, Email: team.Email, FullName: "Corey Hulen", Password: "pwd"} + userAdmin = Client.Must(Client.CreateUser(userAdmin, "")).Data.(*model.User) + store.Must(Srv.Store.User().VerifyEmail(userAdmin.Id)) + user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", FullName: "Corey Hulen", Password: "pwd"} user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) store.Must(Srv.Store.User().VerifyEmail(user1.Id)) @@ -521,8 +525,16 @@ func TestDeletePosts(t *testing.T) { r2 := Client.Must(Client.GetPosts(channel1.Id, 0, 10, "")).Data.(*model.PostList) if len(r2.Posts) != 4 { - t.Fatal("should have returned 5 items") + t.Fatal("should have returned 4 items") } + + time.Sleep(10 * time.Millisecond) + post4 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a"} + post4 = Client.Must(Client.CreatePost(post4)).Data.(*model.Post) + + Client.LoginByEmail(team.Domain, userAdmin.Email, "pwd") + + Client.Must(Client.DeletePost(channel1.Id, post4.Id)) } func TestEmailMention(t *testing.T) { |