Added the SearchPostsInTeam method to the plugin API (#10106)
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
87e36a3ecf
Коммит
c08fda1337
@@ -693,6 +693,52 @@ func TestPluginAPISearchChannels(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestPluginAPISearchPostsInTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
api := th.SetupPluginAPI()
|
||||
|
||||
testCases := []struct {
|
||||
description string
|
||||
teamId string
|
||||
params []*model.SearchParams
|
||||
expectedPostsLen int
|
||||
}{
|
||||
{
|
||||
"nil params",
|
||||
th.BasicTeam.Id,
|
||||
nil,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"empty params",
|
||||
th.BasicTeam.Id,
|
||||
[]*model.SearchParams{},
|
||||
0,
|
||||
},
|
||||
{
|
||||
"doesn't match any posts",
|
||||
th.BasicTeam.Id,
|
||||
model.ParseSearchParams("bad message", 0),
|
||||
0,
|
||||
},
|
||||
{
|
||||
"matched posts",
|
||||
th.BasicTeam.Id,
|
||||
model.ParseSearchParams(th.BasicPost.Message, 0),
|
||||
1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.description, func(t *testing.T) {
|
||||
posts, err := api.SearchPostsInTeam(testCase.teamId, testCase.params)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, testCase.expectedPostsLen, len(posts))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPluginAPIGetChannelsForTeamForUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Ссылка в новой задаче
Block a user