소스 검색

Add test for correct AP outbox pagination

object-id-column
D Anzorge 4 년 전
부모
커밋
9aca2cc95d
1개의 변경된 파일23개의 추가작업 그리고 0개의 파일을 삭제
  1. +23
    -0
      test/web/activity_pub/views/user_view_test.exs

+ 23
- 0
test/web/activity_pub/views/user_view_test.exs 파일 보기

@@ -142,4 +142,27 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
assert %{"totalItems" => 1} = UserView.render("following.json", %{user: user})
end
end

test "outbox paginates correctly" do
user = insert(:user)

posts =
for i <- 0..25 do
{:ok, activity} = CommonAPI.post(user, %{"status" => "post #{i}"})
activity
end

# outbox sorts chronologically, newest first, with ten per page
posts = Enum.reverse(posts)

%{"first" => %{"next" => next_url}} =
UserView.render("outbox.json", %{user: user, max_id: nil})

next_id = Enum.at(posts, 9).id
assert next_url =~ next_id

%{"next" => next_url} = UserView.render("outbox.json", %{user: user, max_id: next_id})
next_id = Enum.at(posts, 19).id
assert next_url =~ next_id
end
end

불러오는 중...
취소
저장