diff options
Diffstat (limited to 'api4/apitestlib.go')
-rw-r--r-- | api4/apitestlib.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/api4/apitestlib.go b/api4/apitestlib.go index 84f87d494..bb5ee1594 100644 --- a/api4/apitestlib.go +++ b/api4/apitestlib.go @@ -203,6 +203,10 @@ func (me *TestHelper) CreatePost() *model.Post { return me.CreatePostWithClient(me.Client, me.BasicChannel) } +func (me *TestHelper) CreateMessagePost(message string) *model.Post { + return me.CreateMessagePostWithClient(me.Client, me.BasicChannel, message) +} + func (me *TestHelper) CreatePostWithClient(client *model.Client4, channel *model.Channel) *model.Post { id := model.NewId() @@ -220,6 +224,21 @@ func (me *TestHelper) CreatePostWithClient(client *model.Client4, channel *model return rpost } +func (me *TestHelper) CreateMessagePostWithClient(client *model.Client4, channel *model.Channel, message string) *model.Post { + post := &model.Post{ + ChannelId: channel.Id, + Message: message, + } + + utils.DisableDebugLogForTest() + rpost, resp := client.CreatePost(post) + if resp.Error != nil { + panic(resp.Error) + } + utils.EnableDebugLogForTest() + return rpost +} + func (me *TestHelper) LoginBasic() { me.LoginBasicWithClient(me.Client) } |