Add paging to the GET /emojis endpoint (#6802)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
02335ddad4
Коммит
f54aee1ef5
@@ -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) {
|
||||
|
||||
Ссылка в новой задаче
Block a user