MM-18356: Adds ability to paginate channel search. (#12830)

* MM-18356: Adds ability to paginate channel search.

* MM-18356: Minor refactor.

* MM-18356: Adds doc.

* MM-18356: Fixes doc.

* MM-18356: Some commentary, adds the total count to non-paginated responses, and removes a stray fmt.

* MM-18356: Fixes shadowed variable.

* MM-18356: Removes paginate field and API parameter.

* MM-18356: Adds method to check if channel search is a paginated request.

* MM-18356: Vet fix.
Этот коммит содержится в:
Martin Kraft
2019-11-19 11:38:49 -05:00
коммит произвёл GitHub
родитель 608a137d2b
Коммит 0212845385
11 изменённых файлов: 141 добавлений и 37 удалений

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

@@ -1075,6 +1075,24 @@ func TestSearchAllChannels(t *testing.T) {
CheckForbiddenStatus(t, resp)
}
func TestSearchAllChannelsPaged(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
search := &model.ChannelSearch{Term: th.BasicChannel.Name}
search.Term = ""
search.Page = model.NewInt(0)
search.PerPage = model.NewInt(2)
channelsWithCount, resp := th.SystemAdminClient.SearchAllChannelsPaged(search)
CheckNoError(t, resp)
require.Len(t, *channelsWithCount.Channels, 2)
search.Term = th.BasicChannel.Name
_, resp = Client.SearchAllChannels(search)
CheckForbiddenStatus(t, resp)
}
func TestSearchGroupChannels(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()