X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Fmastodon_api%2Fcontrollers%2Faccount_controller_test.exs;h=2f5bfda985faed8b07f278025aae4e583df7488b;hb=ed84210da3eeee8e448a3a609f7c4da90d798038;hp=ba2f196f2954854c295c87cc4faa980d51cc2b39;hpb=0e93775ed0a35e348a0d13003680a478612fd6e3;p=akkoma
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..2f5bfda98 100644
--- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
@@ -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
@@ -1025,8 +1027,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
user = Repo.preload(token_from_db, :user).user
assert user
- refute user.confirmation_pending
- refute user.approval_pending
+ assert user.is_confirmed
+ assert user.is_approved
end
test "registers but does not log in with :account_activation_required", %{conn: conn} do
@@ -1086,7 +1088,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
refute response["token_type"]
user = Repo.get_by(User, email: "lain@example.org")
- assert user.confirmation_pending
+ refute user.is_confirmed
end
test "registers but does not log in with :account_approval_required", %{conn: conn} do
@@ -1148,7 +1150,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
user = Repo.get_by(User, email: "lain@example.org")
- assert user.approval_pending
+ refute user.is_approved
assert user.registration_reason == "I'm a cool dude, bro"
end