summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/post_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/api/post_test.go b/api/post_test.go
index 8b5cbd454..901a7c6d0 100644
--- a/api/post_test.go
+++ b/api/post_test.go
@@ -39,7 +39,7 @@ func TestCreatePost(t *testing.T) {
adminUser := th.CreateUser(th.SystemAdminClient)
th.LinkUserToTeam(adminUser, adminTeam)
- post1 := &model.Post{ChannelId: channel1.Id, Message: "#hashtag a" + model.NewId() + "a"}
+ post1 := &model.Post{ChannelId: channel1.Id, Message: "#hashtag a" + model.NewId() + "a", Props: model.StringInterface{model.PROPS_ADD_CHANNEL_MEMBER: "no good"}}
rpost1, err := Client.CreatePost(post1)
if err != nil {
t.Fatal(err)
@@ -61,6 +61,10 @@ func TestCreatePost(t *testing.T) {
t.Fatal("Newly craeted post shouldn't have EditAt set")
}
+ if rpost1.Data.(*model.Post).Props[model.PROPS_ADD_CHANNEL_MEMBER] != nil {
+ t.Fatal("newly created post shouldn't have Props['add_channel_member'] set")
+ }
+
_, err = Client.CreatePost(&model.Post{ChannelId: channel1.Id, Message: "#hashtag a" + model.NewId() + "a", Type: model.POST_SYSTEM_GENERIC})
if err == nil {
t.Fatal("should have failed - bad post type")
@@ -433,6 +437,7 @@ func TestUpdatePost(t *testing.T) {
msg2 := "zz" + model.NewId() + " update post 1"
rpost2.Data.(*model.Post).Message = msg2
+ rpost2.Data.(*model.Post).Props[model.PROPS_ADD_CHANNEL_MEMBER] = "no good"
if rupost2, err := Client.UpdatePost(rpost2.Data.(*model.Post)); err != nil {
t.Fatal(err)
} else {
@@ -442,6 +447,9 @@ func TestUpdatePost(t *testing.T) {
if rupost2.Data.(*model.Post).EditAt == 0 {
t.Fatal("EditAt not updated for post")
}
+ if rupost2.Data.(*model.Post).Props[model.PROPS_ADD_CHANNEL_MEMBER] != nil {
+ t.Fatal("failed to sanitize Props['add_channel_member'], should be nil")
+ }
}
msg1 := "#hashtag a" + model.NewId() + " update post 2"