diff options
author | rinpatch <rinpatch@sdf.org> | 2019-09-26 06:11:52 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-09-26 06:11:52 +0000 |
commit | 2b98ef832ca7db7be86667646502c47a43e5d7af (patch) | |
tree | bfbc37f3692d16288b8f34867efbc85cb930f58c /test/web/activity_pub/views | |
parent | 53b4daa514479172c6b63e655bf626175c5f0f35 (diff) | |
parent | 6d1ca73466bddb40684a2b3f545da6676ed71add (diff) | |
download | pleroma-2b98ef832ca7db7be86667646502c47a43e5d7af.tar.gz pleroma-2b98ef832ca7db7be86667646502c47a43e5d7af.zip |
Merge branch 'backport/1.1-hackney-and-outbox-fixes' into 'maint/1.1'
Backport/1.1 hackney and outbox fixes
See merge request pleroma/pleroma!1718
Diffstat (limited to 'test/web/activity_pub/views')
-rw-r--r-- | test/web/activity_pub/views/user_view_test.exs | 31 |
1 files changed, 31 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 fb7fd9e79..dbb44a8a2 100644 --- a/test/web/activity_pub/views/user_view_test.exs +++ b/test/web/activity_pub/views/user_view_test.exs @@ -121,5 +121,36 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do user = Map.put(user, :info, info) assert %{"totalItems" => 0} = UserView.render("following.json", %{user: user}) end + + test "activity collection page aginates 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) + + %{"next" => next_url} = + UserView.render("activity_collection_page.json", %{ + iri: "#{user.ap_id}/outbox", + activities: Enum.take(posts, 10) + }) + + next_id = Enum.at(posts, 9).id + assert next_url =~ next_id + + %{"next" => next_url} = + UserView.render("activity_collection_page.json", %{ + iri: "#{user.ap_id}/outbox", + activities: Enum.take(Enum.drop(posts, 10), 10) + }) + + next_id = Enum.at(posts, 19).id + assert next_url =~ next_id + end end end |