diff options
author | =Corey Hulen <corey@hulen.com> | 2016-01-22 08:04:02 -0600 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-01-22 08:04:02 -0600 |
commit | 518efd7d2e971572c104dde09f90ef9f7619dd08 (patch) | |
tree | caaeda69687ea5e2156a1a0b5fa4314bb1a49724 /api | |
parent | dd52e3f729a63e4c1001bebbad236258ef880de4 (diff) | |
download | chat-518efd7d2e971572c104dde09f90ef9f7619dd08.tar.gz chat-518efd7d2e971572c104dde09f90ef9f7619dd08.tar.bz2 chat-518efd7d2e971572c104dde09f90ef9f7619dd08.zip |
PLT-7 fixing unit test for chunk 2 server
Diffstat (limited to 'api')
-rw-r--r-- | api/post.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/api/post.go b/api/post.go index ee1429d90..bb6bcb337 100644 --- a/api/post.go +++ b/api/post.go @@ -53,7 +53,9 @@ func createPost(c *Context, w http.ResponseWriter, r *http.Request) { if rp, err := CreatePost(c, post, true); err != nil { c.Err = err - if strings.Contains(c.Err.Message, "parameter") { + if c.Err.Id == "api.post.create_post.root_id.app_error" || + c.Err.Id == "api.post.create_post.channel_root_id.app_error" || + c.Err.Id == "api.post.create_post.parent_id.app_error" { c.Err.StatusCode = http.StatusBadRequest } @@ -75,15 +77,12 @@ func CreatePost(c *Context, post *model.Post, triggerWebhooks bool) (*model.Post // Verify the parent/child relationships are correct if pchan != nil { - // somehow tests fail here if we use the commented lines if presult := <-pchan; presult.Err != nil { - //return nil, model.NewLocAppError("createPost", "api.post.create_post.root_id.app_error", nil, "") - return nil, model.NewAppError("createPost", "Invalid RootId parameter", "") + return nil, model.NewLocAppError("createPost", "api.post.create_post.root_id.app_error", nil, "") } else { list := presult.Data.(*model.PostList) if len(list.Posts) == 0 || !list.IsChannelId(post.ChannelId) { - //return nil, model.NewLocAppError("createPost", "api.post.create_post.channel_root_id.app_error", nil, "") - return nil, model.NewAppError("createPost", "Invalid ChannelId for RootId parameter", "") + return nil, model.NewLocAppError("createPost", "api.post.create_post.channel_root_id.app_error", nil, "") } if post.ParentId == "" { @@ -93,8 +92,7 @@ func CreatePost(c *Context, post *model.Post, triggerWebhooks bool) (*model.Post if post.RootId != post.ParentId { parent := list.Posts[post.ParentId] if parent == nil { - //return nil, model.NewLocAppError("createPost", "api.post.create_post.parent_id.app_error", nil, "") - return nil, model.NewAppError("createPost", "Invalid ParentId parameter", "") + return nil, model.NewLocAppError("createPost", "api.post.create_post.parent_id.app_error", nil, "") } } } |