Add paging to the GET /emojis endpoint (#6802)

Этот коммит содержится в:
Joram Wilander
2017-07-04 02:58:02 -04:00
коммит произвёл Christopher Speller
родитель 02335ddad4
Коммит f54aee1ef5
8 изменённых файлов: 24 добавлений и 15 удалений

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

@@ -81,7 +81,7 @@ func getEmojiList(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
listEmoji, err := app.GetEmojiList()
listEmoji, err := app.GetEmojiList(c.Params.Page, c.Params.PerPage)
if err != nil {
c.Err = err
return

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

@@ -173,7 +173,7 @@ func TestGetEmojiList(t *testing.T) {
emojis[idx] = emoji
}
listEmoji, resp := Client.GetEmojiList()
listEmoji, resp := Client.GetEmojiList(0, 100)
CheckNoError(t, resp)
for _, emoji := range emojis {
found := false
@@ -190,7 +190,7 @@ func TestGetEmojiList(t *testing.T) {
_, resp = Client.DeleteEmoji(emojis[0].Id)
CheckNoError(t, resp)
listEmoji, resp = Client.GetEmojiList()
listEmoji, resp = Client.GetEmojiList(0, 100)
CheckNoError(t, resp)
found := false
for _, savedEmoji := range listEmoji {
@@ -202,6 +202,13 @@ func TestGetEmojiList(t *testing.T) {
t.Fatalf("should not get a deleted emoji %v", emojis[0].Id)
}
}
listEmoji, resp = Client.GetEmojiList(0, 1)
CheckNoError(t, resp)
if len(listEmoji) != 1 {
t.Fatal("should only return 1")
}
}
func TestDeleteEmoji(t *testing.T) {