summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2018-11-13 19:46:34 +0100
committerlain <lain@soykaf.club>2018-11-13 19:46:34 +0100
commit2cf40237ff44cdb04b20546ca51efb671270dbc2 (patch)
tree8d2526d3aeed3c842c94a2a197847ef7862cfab4 /test
parent0ce5623134de4356e74160f8d3e717aae414b1e7 (diff)
downloadpleroma-2cf40237ff44cdb04b20546ca51efb671270dbc2.tar.gz
pleroma-2cf40237ff44cdb04b20546ca51efb671270dbc2.zip
MastodonAPI: Add pagination to private messages.
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 3f9324fcc..ad67cae6b 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -178,6 +178,32 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> get("api/v1/timelines/home")
[_s1, _s2] = json_response(res_conn, 200)
+
+ # Test pagination
+ Enum.each(1..20, fn _ ->
+ {:ok, _} =
+ CommonAPI.post(user_one, %{
+ "status" => "Hi @#{user_two.nickname}!",
+ "visibility" => "direct"
+ })
+ end)
+
+ res_conn =
+ conn
+ |> assign(:user, user_two)
+ |> get("api/v1/timelines/direct")
+
+ statuses = json_response(res_conn, 200)
+ assert length(statuses) == 20
+
+ res_conn =
+ conn
+ |> assign(:user, user_two)
+ |> get("api/v1/timelines/direct", %{max_id: List.last(statuses)["id"]})
+
+ [status] = json_response(res_conn, 200)
+
+ assert status["url"] != direct.data["id"]
end
test "replying to a status", %{conn: conn} do