diff options
author | lain <lain@soykaf.club> | 2019-09-19 16:53:59 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-09-19 16:53:59 +0000 |
commit | b80c41a14f5b621311971469c663903e13ad3a33 (patch) | |
tree | 679ca9675ecbc1030a7666c9cf661245e63f9c3f /test | |
parent | 9c8a94bae226bfff65a0c4ec265b593226e1f912 (diff) | |
parent | 9aca2cc95d0d8886d35be17e5cdd683004b425d9 (diff) | |
download | pleroma-b80c41a14f5b621311971469c663903e13ad3a33.tar.gz pleroma-b80c41a14f5b621311971469c663903e13ad3a33.zip |
Merge branch 'outbox_pagination' into 'develop'
Fix AP outbox pagination
See merge request pleroma/pleroma!1700
Diffstat (limited to 'test')
-rw-r--r-- | test/web/activity_pub/views/user_view_test.exs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/web/activity_pub/views/user_view_test.exs b/test/web/activity_pub/views/user_view_test.exs index 2b4a04afd..eda95e3ea 100644 --- a/test/web/activity_pub/views/user_view_test.exs +++ b/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 |