diff options
Diffstat (limited to 'api4')
-rw-r--r-- | api4/post_test.go | 20 |
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") } |