diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-10-09 13:30:48 -0400 |
---|---|---|
committer | Chris <ccbrown112@gmail.com> | 2017-10-09 10:30:48 -0700 |
commit | 9adaf53e110e0e806b21903111aacb93129668cb (patch) | |
tree | edea5dfe0b71945142898840d0485adb57750b31 /api/post_test.go | |
parent | 0da0cf1a21d7dea61f4459ee71bf01b6ca362aee (diff) | |
download | chat-9adaf53e110e0e806b21903111aacb93129668cb.tar.gz chat-9adaf53e110e0e806b21903111aacb93129668cb.tar.bz2 chat-9adaf53e110e0e806b21903111aacb93129668cb.zip |
PLT-7818 Updates to post type (#7579)
* Updates to post type
* Update tests
Diffstat (limited to 'api/post_test.go')
-rw-r--r-- | api/post_test.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/api/post_test.go b/api/post_test.go index f57c2e05c..c01a5fa93 100644 --- a/api/post_test.go +++ b/api/post_test.go @@ -61,6 +61,11 @@ func TestCreatePost(t *testing.T) { t.Fatal("Newly craeted post shouldn't have EditAt 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") + } + post2 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id} rpost2, err := Client.CreatePost(post2) if err != nil { @@ -454,13 +459,12 @@ func TestUpdatePost(t *testing.T) { } } - post3 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", Type: model.POST_JOIN_LEAVE} - rpost3, err := Client.CreatePost(post3) + rpost3, err := th.App.CreatePost(&model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", Type: model.POST_JOIN_LEAVE, UserId: th.BasicUser.Id}, channel1, false) if err != nil { t.Fatal(err) } - up3 := &model.Post{Id: rpost3.Data.(*model.Post).Id, ChannelId: channel1.Id, Message: "zz" + model.NewId() + " update post 3"} + up3 := &model.Post{Id: rpost3.Id, ChannelId: channel1.Id, Message: "zz" + model.NewId() + " update post 3"} if _, err := Client.UpdatePost(up3); err == nil { t.Fatal("shouldn't have been able to update system message") } |