Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel
[akkoma] / test / web / mastodon_api / controllers / account_controller / update_credentials_test.exs
index 599cd61c811cae81dbf8eee80512de389b88022d..77cfce4fa8e10fbcc0f6730f069434e75c7cf3be 100644 (file)
@@ -103,6 +103,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
       assert user["locked"] == true
     end
 
+    test "updates the user's allow_following_move", %{conn: conn} do
+      user = insert(:user)
+
+      assert user.allow_following_move == true
+
+      conn =
+        conn
+        |> assign(:user, user)
+        |> patch("/api/v1/accounts/update_credentials", %{allow_following_move: "false"})
+
+      assert refresh_record(user).allow_following_move == false
+      assert user = json_response(conn, 200)
+      assert user["pleroma"]["allow_following_move"] == false
+    end
+
     test "updates the user's default scope", %{conn: conn} do
       user = insert(:user)
 
@@ -153,7 +168,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
         |> json_response(200)
 
       assert response["pleroma"]["skip_thread_containment"] == true
-      assert refresh_record(user).info.skip_thread_containment
+      assert refresh_record(user).skip_thread_containment
     end
 
     test "updates the user's hide_follows status", %{conn: conn} do
@@ -272,7 +287,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
       assert user_response["pleroma"]["background_image"]
     end
 
-    test "requires 'write' permission", %{conn: conn} do
+    test "requires 'write:accounts' permission", %{conn: conn} do
       token1 = insert(:oauth_token, scopes: ["read"])
       token2 = insert(:oauth_token, scopes: ["write", "follow"])
 
@@ -283,7 +298,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
           |> patch("/api/v1/accounts/update_credentials", %{})
 
         if token == token1 do
-          assert %{"error" => "Insufficient permissions: write."} == json_response(conn, 403)
+          assert %{"error" => "Insufficient permissions: write:accounts."} ==
+                   json_response(conn, 403)
         else
           assert json_response(conn, 200)
         end