Add `account_activation_required` to /api/v1/instance
[akkoma] / test / web / mastodon_api / controllers / account_controller_test.exs
index 0d48ae4ae944a92deaf51b35e1c94c3421ba8421..1ce97378d18fabe0f7a106503839d9f156c580e5 100644 (file)
@@ -226,7 +226,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
       user = insert(:user, ap_id: "https://honktest/u/test", local: false)
       other_user = insert(:user)
 
-      {:ok, post} = CommonAPI.post(other_user, %{"status" => "bonkeronk"})
+      {:ok, post} = CommonAPI.post(other_user, %{status: "bonkeronk"})
 
       {:ok, announce, _} =
         %{
@@ -255,8 +255,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
 
       User.block(user_one, user_two)
 
-      {:ok, activity} = CommonAPI.post(user_two, %{"status" => "User one sux0rz"})
-      {:ok, repeat, _} = CommonAPI.repeat(activity.id, user_three)
+      {:ok, activity} = CommonAPI.post(user_two, %{status: "User one sux0rz"})
+      {:ok, repeat} = CommonAPI.repeat(activity.id, user_three)
 
       assert resp =
                conn
@@ -298,16 +298,16 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
 
       {:ok, _user_three} = User.follow(user_three, user_one)
 
-      {:ok, activity} = CommonAPI.post(user_one, %{"status" => "HI!!!"})
+      {:ok, activity} = CommonAPI.post(user_one, %{status: "HI!!!"})
 
       {:ok, direct_activity} =
         CommonAPI.post(user_one, %{
-          "status" => "Hi, @#{user_two.nickname}.",
-          "visibility" => "direct"
+          status: "Hi, @#{user_two.nickname}.",
+          visibility: "direct"
         })
 
       {:ok, private_activity} =
-        CommonAPI.post(user_one, %{"status" => "private", "visibility" => "private"})
+        CommonAPI.post(user_one, %{status: "private", visibility: "private"})
 
       # TODO!!!
       resp =
@@ -362,8 +362,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
 
       {:ok, %{id: media_id}} = ActivityPub.upload(file, actor: user.ap_id)
 
-      {:ok, %{id: image_post_id}} =
-        CommonAPI.post(user, %{"status" => "cofe", "media_ids" => [media_id]})
+      {:ok, %{id: image_post_id}} = CommonAPI.post(user, %{status: "cofe", media_ids: [media_id]})
 
       conn = get(conn, "/api/v1/accounts/#{user.id}/statuses?only_media=true")
 
@@ -375,8 +374,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
     end
 
     test "gets a user's statuses without reblogs", %{user: user, conn: conn} do
-      {:ok, %{id: post_id}} = CommonAPI.post(user, %{"status" => "HI!!!"})
-      {:ok, _, _} = CommonAPI.repeat(post_id, user)
+      {:ok, %{id: post_id}} = CommonAPI.post(user, %{status: "HI!!!"})
+      {:ok, _} = CommonAPI.repeat(post_id, user)
 
       conn = get(conn, "/api/v1/accounts/#{user.id}/statuses?exclude_reblogs=true")
       assert [%{"id" => ^post_id}] = json_response_and_validate_schema(conn, 200)
@@ -386,8 +385,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
     end
 
     test "filters user's statuses by a hashtag", %{user: user, conn: conn} do
-      {:ok, %{id: post_id}} = CommonAPI.post(user, %{"status" => "#hashtag"})
-      {:ok, _post} = CommonAPI.post(user, %{"status" => "hashtag"})
+      {:ok, %{id: post_id}} = CommonAPI.post(user, %{status: "#hashtag"})
+      {:ok, _post} = CommonAPI.post(user, %{status: "hashtag"})
 
       conn = get(conn, "/api/v1/accounts/#{user.id}/statuses?tagged=hashtag")
       assert [%{"id" => ^post_id}] = json_response_and_validate_schema(conn, 200)
@@ -398,9 +397,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
       conn: conn
     } do
       {:ok, %{id: public_activity_id}} =
-        CommonAPI.post(user, %{"status" => ".", "visibility" => "public"})
+        CommonAPI.post(user, %{status: ".", visibility: "public"})
 
-      {:ok, _direct_activity} = CommonAPI.post(user, %{"status" => ".", "visibility" => "direct"})
+      {:ok, _direct_activity} = CommonAPI.post(user, %{status: ".", visibility: "direct"})
 
       conn = get(conn, "/api/v1/accounts/#{user.id}/statuses?exclude_visibilities[]=direct")
       assert [%{"id" => ^public_activity_id}] = json_response_and_validate_schema(conn, 200)
@@ -678,8 +677,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
 
       assert %{"showing_reblogs" => false} = json_response_and_validate_schema(ret_conn, 200)
 
-      {:ok, activity} = CommonAPI.post(other_user, %{"status" => "hey"})
-      {:ok, %{id: reblog_id}, _} = CommonAPI.repeat(activity.id, followed)
+      {:ok, activity} = CommonAPI.post(other_user, %{status: "hey"})
+      {:ok, %{id: reblog_id}} = CommonAPI.repeat(activity.id, followed)
 
       assert [] ==
                conn
@@ -777,7 +776,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
   describe "pinned statuses" do
     setup do
       user = insert(:user)
-      {:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!"})
+      {:ok, activity} = CommonAPI.post(user, %{status: "HI!!!"})
       %{conn: conn} = oauth_access(["read:statuses"], user: user)
 
       [conn: conn, user: user, activity: activity]