summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api
diff options
context:
space:
mode:
Diffstat (limited to 'test/web/mastodon_api')
-rw-r--r--test/web/mastodon_api/account_view_test.exs4
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs32
2 files changed, 24 insertions, 12 deletions
diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs
index dc52b92bc..a2d3a2547 100644
--- a/test/web/mastodon_api/account_view_test.exs
+++ b/test/web/mastodon_api/account_view_test.exs
@@ -17,7 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
user =
insert(:user, %{
- info: %{"note_count" => 5, "follower_count" => 3, "source_data" => source_data},
+ info: %{note_count: 5, follower_count: 3, source_data: source_data},
nickname: "shp@shitposter.club",
name: ":karjalanpiirakka: shp",
bio: "<script src=\"invalid-html\"></script><span>valid html</span>",
@@ -63,7 +63,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
test "Represent a Service(bot) account" do
user =
insert(:user, %{
- info: %{"note_count" => 5, "follower_count" => 3, "source_data" => %{"type" => "Service"}},
+ info: %{note_count: 5, follower_count: 3, source_data: %{"type" => "Service"}},
nickname: "shp@shitposter.club",
inserted_at: ~N[2017-08-15 15:47:06.597036]
})
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index ad67cae6b..7042a6ace 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -252,7 +252,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end
test "verify_credentials default scope unlisted", %{conn: conn} do
- user = insert(:user, %{info: %{"default_scope" => "unlisted"}})
+ user = insert(:user, %{info: %Pleroma.User.Info{default_scope: "unlisted"}})
conn =
conn
@@ -845,7 +845,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
describe "locked accounts" do
test "/api/v1/follow_requests works" do
- user = insert(:user, %{info: %{"locked" => true}})
+ user = insert(:user, %{info: %Pleroma.User.Info{locked: true}})
other_user = insert(:user)
{:ok, activity} = ActivityPub.follow(other_user, user)
@@ -865,7 +865,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end
test "/api/v1/follow_requests/:id/authorize works" do
- user = insert(:user, %{info: %{"locked" => true}})
+ user = insert(:user, %{info: %Pleroma.User.Info{locked: true}})
other_user = insert(:user)
{:ok, activity} = ActivityPub.follow(other_user, user)
@@ -890,7 +890,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end
test "verify_credentials", %{conn: conn} do
- user = insert(:user, %{info: %{"default_scope" => "private"}})
+ user = insert(:user, %{info: %Pleroma.User.Info{default_scope: "private"}})
conn =
conn
@@ -902,7 +902,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end
test "/api/v1/follow_requests/:id/reject works" do
- user = insert(:user, %{info: %{"locked" => true}})
+ user = insert(:user, %{info: %Pleroma.User.Info{locked: true}})
other_user = insert(:user)
{:ok, activity} = ActivityPub.follow(other_user, user)
@@ -1105,7 +1105,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
refute User.blocks?(user, other_user)
end
- test "getting a list of domain blocks" do
+ test "getting a list of domain blocks", %{conn: conn} do
user = insert(:user)
{:ok, user} = User.block_domain(user, "bad.site")
@@ -1263,6 +1263,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert user["note"] == "I drink #cofe"
end
+ test "updates the user's locking status", %{conn: conn} do
+ user = insert(:user)
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> patch("/api/v1/accounts/update_credentials", %{locked: "true"})
+
+ assert user = json_response(conn, 200)
+ assert user["locked"] == true
+ end
+
test "updates the user's name", %{conn: conn} do
user = insert(:user)
@@ -1289,8 +1301,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> assign(:user, user)
|> patch("/api/v1/accounts/update_credentials", %{"avatar" => new_avatar})
- assert user = json_response(conn, 200)
- assert user["avatar"] != "https://placehold.it/48x48"
+ assert user_response = json_response(conn, 200)
+ assert user_response["avatar"] != User.avatar_url(user)
end
test "updates the user's banner", %{conn: conn} do
@@ -1307,8 +1319,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> assign(:user, user)
|> patch("/api/v1/accounts/update_credentials", %{"header" => new_header})
- assert user = json_response(conn, 200)
- assert user["header"] != "https://placehold.it/700x335"
+ assert user_response = json_response(conn, 200)
+ assert user_response["header"] != User.banner_url(user)
end
end