summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2021-01-05 11:48:40 +0100
committerlain <lain@soykaf.club>2021-01-05 11:48:40 +0100
commit95a0ae8a35f97eb27423ca0e7da722e8f7f135e5 (patch)
tree2846dcd454cd06ef3de0910348ccdb556ddd0623
parent0e93775ed0a35e348a0d13003680a478612fd6e3 (diff)
AccountControllerTest: Fix test logic
-rw-r--r--test/pleroma/web/mastodon_api/controllers/account_controller_test.exs16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
index ba2f196f2..cc7b3cf8b 100644
--- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
@@ -471,16 +471,18 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
end
test "paginates a user's statuses", %{user: user, conn: conn} do
- {:ok, post1} = CommonAPI.post(user, %{status: "first post"})
- {:ok, _} = CommonAPI.post(user, %{status: "second post"})
+ {:ok, post_1} = CommonAPI.post(user, %{status: "first post"})
+ {:ok, post_2} = CommonAPI.post(user, %{status: "second post"})
- response1 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1")
- assert json_response(response1, 200) |> length() == 1
+ response_1 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1")
+ assert [res] = json_response(response_1, 200)
+ assert res["id"] == post_2.id
- response2 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1&min_id=#{post1.id}")
- assert json_response(response2, 200) |> length() == 1
+ response_2 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1&max_id=#{res["id"]}")
+ assert [res] = json_response(response_2, 200)
+ assert res["id"] == post_1.id
- refute response1 == response2
+ refute response_1 == response_2
end
end