summaryrefslogtreecommitdiffstats
path: root/api4/post_test.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-08-24 11:36:39 +0200
committerGitHub <noreply@github.com>2018-08-24 11:36:39 +0200
commit5876b52ecd0b434dc8fcc0f278c3ce7dcae30d06 (patch)
tree8fa91548eb37ffa3370fb80160e971bb46d6775a /api4/post_test.go
parentbba3bbd9f3e250cca0ce705e664382fe3ad6e78a (diff)
parentd2945cdd77bdf1ee03367a0d45624094fb936c19 (diff)
downloadchat-5876b52ecd0b434dc8fcc0f278c3ce7dcae30d06.tar.gz
chat-5876b52ecd0b434dc8fcc0f278c3ce7dcae30d06.tar.bz2
chat-5876b52ecd0b434dc8fcc0f278c3ce7dcae30d06.zip
Merge release-5.2
Diffstat (limited to 'api4/post_test.go')
-rw-r--r--api4/post_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/api4/post_test.go b/api4/post_test.go
index 036a64fc7..910443fef 100644
--- a/api4/post_test.go
+++ b/api4/post_test.go
@@ -1273,6 +1273,16 @@ func TestGetPostThread(t *testing.T) {
func TestSearchPosts(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
+ experimentalViewArchivedChannels := *th.App.Config().TeamSettings.ExperimentalViewArchivedChannels
+ defer func() {
+ th.App.UpdateConfig(func(cfg *model.Config) {
+ cfg.TeamSettings.ExperimentalViewArchivedChannels = &experimentalViewArchivedChannels
+ })
+ }()
+ th.App.UpdateConfig(func(cfg *model.Config) {
+ *cfg.TeamSettings.ExperimentalViewArchivedChannels = true
+ })
+
th.LoginBasic()
Client := th.Client
@@ -1316,6 +1326,16 @@ func TestSearchPosts(t *testing.T) {
t.Fatal("wrong search")
}
+ th.App.UpdateConfig(func(cfg *model.Config) {
+ *cfg.TeamSettings.ExperimentalViewArchivedChannels = false
+ })
+
+ posts, resp = Client.SearchPostsIncludeDeletedChannels(th.BasicTeam.Id, "#hashtag", false)
+ CheckNoError(t, resp)
+ if len(posts.Order) != 1 {
+ t.Fatal("wrong search")
+ }
+
if posts, resp = Client.SearchPosts(th.BasicTeam.Id, "*", false); len(posts.Order) != 0 {
t.Fatal("searching for just * shouldn't return any results")
}