From cb2bff28ee7a43b3d3c52d3c448d3f15d12830ba Mon Sep 17 00:00:00 2001 From: nickago Date: Tue, 14 Jul 2015 13:09:14 -0700 Subject: Team admin can now delete any post --- api/post_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'api/post_test.go') 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) { -- cgit v1.2.3-1-g7c22 From f0841af393d1d0c48bf27b68fca3be8fde096dd6 Mon Sep 17 00:00:00 2001 From: nickago Date: Thu, 16 Jul 2015 14:47:28 -0700 Subject: Check your credentials from session --- api/post_test.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'api/post_test.go') diff --git a/api/post_test.go b/api/post_test.go index 5009ff54d..37798a0c9 100644 --- a/api/post_test.go +++ b/api/post_test.go @@ -10,6 +10,7 @@ import ( "net/http" "testing" "time" + "fmt" ) func TestCreatePost(t *testing.T) { @@ -534,6 +535,10 @@ func TestDeletePosts(t *testing.T) { Client.LoginByEmail(team.Domain, userAdmin.Email, "pwd") + fmt.Println(userAdmin.Email) + fmt.Println(team.Email) + fmt.Println(userAdmin.Roles) + Client.Must(Client.DeletePost(channel1.Id, post4.Id)) } -- cgit v1.2.3-1-g7c22 From 830430370340d419835246404a9ac353764eb5b3 Mon Sep 17 00:00:00 2001 From: nickago Date: Thu, 16 Jul 2015 14:48:40 -0700 Subject: removed testing material --- api/post_test.go | 4 ---- 1 file changed, 4 deletions(-) (limited to 'api/post_test.go') diff --git a/api/post_test.go b/api/post_test.go index 37798a0c9..c62b4423e 100644 --- a/api/post_test.go +++ b/api/post_test.go @@ -535,10 +535,6 @@ func TestDeletePosts(t *testing.T) { Client.LoginByEmail(team.Domain, userAdmin.Email, "pwd") - fmt.Println(userAdmin.Email) - fmt.Println(team.Email) - fmt.Println(userAdmin.Roles) - Client.Must(Client.DeletePost(channel1.Id, post4.Id)) } -- cgit v1.2.3-1-g7c22 From 372869354f8c4480f39c67348694ca2192747b6d Mon Sep 17 00:00:00 2001 From: nickago Date: Thu, 16 Jul 2015 14:49:15 -0700 Subject: removed testing material --- api/post_test.go | 1 - 1 file changed, 1 deletion(-) (limited to 'api/post_test.go') diff --git a/api/post_test.go b/api/post_test.go index c62b4423e..5009ff54d 100644 --- a/api/post_test.go +++ b/api/post_test.go @@ -10,7 +10,6 @@ import ( "net/http" "testing" "time" - "fmt" ) func TestCreatePost(t *testing.T) { -- cgit v1.2.3-1-g7c22