X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Fmastodon_api%2Fupdate_credentials_test.exs;h=606467fa97a1436c3dfba47bf7d6e8eb18e362b0;hb=0f132b802dde7f217ecb07767e0d34e3edb517b7;hp=023726468ef070892b7ee9808ddcc633da2753ea;hpb=e4f1d8f48c85b8a388d6c3945db157de5ce588c5;p=akkoma diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs index 023726468..606467fa9 100644 --- a/test/pleroma/web/mastodon_api/update_credentials_test.exs +++ b/test/pleroma/web/mastodon_api/update_credentials_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.UpdateCredentialsTest do @@ -88,9 +88,7 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do assert user_data = json_response_and_validate_schema(conn, 200) assert user_data["note"] == - ~s(I drink #cofe with @#{user2.nickname}

suya..) + ~s(I drink #cofe with @#{user2.nickname}

suya..) assert user_data["source"]["note"] == raw_bio @@ -106,13 +104,6 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do assert user_data["locked"] == true end - test "updates the user's chat acceptance status", %{conn: conn} do - conn = patch(conn, "/api/v1/accounts/update_credentials", %{accepts_chat_messages: "false"}) - - assert user_data = json_response_and_validate_schema(conn, 200) - assert user_data["pleroma"]["accepts_chat_messages"] == false - end - test "updates the user's allow_following_move", %{user: user, conn: conn} do assert user.allow_following_move == true @@ -218,6 +209,25 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do assert update_activity.data["object"]["name"] == "markorepairs" end + test "updates the user's AKAs", %{conn: conn} do + conn = + patch(conn, "/api/v1/accounts/update_credentials", %{ + "also_known_as" => ["https://mushroom.kingdom/users/mario"] + }) + + assert user_data = json_response_and_validate_schema(conn, 200) + assert user_data["pleroma"]["also_known_as"] == ["https://mushroom.kingdom/users/mario"] + end + + test "doesn't update non-url akas", %{conn: conn} do + conn = + patch(conn, "/api/v1/accounts/update_credentials", %{ + "also_known_as" => ["aReallyCoolGuy"] + }) + + assert json_response_and_validate_schema(conn, 403) + end + test "updates the user's avatar", %{user: user, conn: conn} do new_avatar = %Plug.Upload{ content_type: "image/jpeg",