summaryrefslogtreecommitdiffstats
path: root/api/apitestlib.go
diff options
context:
space:
mode:
authorGabin Aureche <gabin.aureche@live.fr>2017-03-13 13:25:08 +0100
committerGeorge Goldberg <george@gberg.me>2017-03-13 12:25:08 +0000
commitfe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81 (patch)
treeb96d457cde64b7397f91028106e93a7f92a179bd /api/apitestlib.go
parent482a0fb5fc248b1ec61db35299dc3e6d963ad5ab (diff)
downloadchat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.tar.gz
chat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.tar.bz2
chat-fe38d6d5bb36e18ddefbe490cc21f48f4f4c8d81.zip
Add pinned posts (#4217)
Diffstat (limited to 'api/apitestlib.go')
-rw-r--r--api/apitestlib.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/api/apitestlib.go b/api/apitestlib.go
index 475469a36..df5ac5d26 100644
--- a/api/apitestlib.go
+++ b/api/apitestlib.go
@@ -21,6 +21,7 @@ type TestHelper struct {
BasicUser2 *model.User
BasicChannel *model.Channel
BasicPost *model.Post
+ PinnedPost *model.Post
SystemAdminClient *model.Client
SystemAdminTeam *model.Team
@@ -91,6 +92,9 @@ func (me *TestHelper) InitBasic() *TestHelper {
me.BasicChannel = me.CreateChannel(me.BasicClient, me.BasicTeam)
me.BasicPost = me.CreatePost(me.BasicClient, me.BasicChannel)
+ pinnedPostChannel := me.CreateChannel(me.BasicClient, me.BasicTeam)
+ me.PinnedPost = me.CreatePinnedPost(me.BasicClient, pinnedPostChannel)
+
return me
}
@@ -265,6 +269,21 @@ func (me *TestHelper) CreatePost(client *model.Client, channel *model.Channel) *
return r
}
+func (me *TestHelper) CreatePinnedPost(client *model.Client, channel *model.Channel) *model.Post {
+ id := model.NewId()
+
+ post := &model.Post{
+ ChannelId: channel.Id,
+ Message: "message_" + id,
+ IsPinned: true,
+ }
+
+ utils.DisableDebugLogForTest()
+ r := client.Must(client.CreatePost(post)).Data.(*model.Post)
+ utils.EnableDebugLogForTest()
+ return r
+}
+
func (me *TestHelper) LoginBasic() {
utils.DisableDebugLogForTest()
me.BasicClient.Must(me.BasicClient.Login(me.BasicUser.Email, me.BasicUser.Password))