Этот коммит содержится в:
Gabin Aureche
2017-03-13 13:25:08 +01:00
коммит произвёл George Goldberg
родитель 482a0fb5fc
Коммит fe38d6d5bb
38 изменённых файлов: 885 добавлений и 52 удалений

Просмотреть файл

@@ -926,8 +926,8 @@ func TestGetMoreChannelsPage(t *testing.T) {
} else {
channels := r.Data.(*model.ChannelList)
// 1 for BasicChannel, 2 for open channels created above
if len(*channels) != 3 {
// 1 for BasicChannel, 1 for PinnedPostChannel, 2 for open channels created above
if len(*channels) != 4 {
t.Fatal("wrong length")
}
@@ -990,11 +990,11 @@ func TestGetChannelCounts(t *testing.T) {
} else {
counts := result.Data.(*model.ChannelCounts)
if len(counts.Counts) != 5 {
if len(counts.Counts) != 6 {
t.Fatal("wrong number of channel counts")
}
if len(counts.UpdateTimes) != 5 {
if len(counts.UpdateTimes) != 6 {
t.Fatal("wrong number of channel update times")
}
@@ -1024,8 +1024,8 @@ func TestGetMyChannelMembers(t *testing.T) {
} else {
members := result.Data.(*model.ChannelMembers)
// town-square, off-topic, basic test channel, channel1, channel2
if len(*members) != 5 {
// town-square, off-topic, basic test channel, pinned post channel, channel1, channel2
if len(*members) != 6 {
t.Fatal("wrong number of members", len(*members))
}
}
@@ -2117,3 +2117,24 @@ func TestUpdateChannelRoles(t *testing.T) {
t.Fatal("Channel member should not be able to promote itself to channel admin:", meta)
}
}
func TestGetPinnedPosts(t *testing.T) {
th := Setup().InitBasic()
Client := th.BasicClient
post1 := th.BasicPost
r1 := Client.Must(Client.GetPinnedPosts(post1.ChannelId)).Data.(*model.PostList)
if len(r1.Order) != 0 {
t.Fatal("should not have gotten a pinned post")
}
post2 := th.PinnedPost
r2 := Client.Must(Client.GetPinnedPosts(post2.ChannelId)).Data.(*model.PostList)
if len(r2.Order) == 0 {
t.Fatal("should have gotten a pinned post")
}
if _, ok := r2.Posts[post2.Id]; !ok {
t.Fatal("missing pinned post")
}
}