diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 50 | ||||
| -rw-r--r-- | test/web/mastodon_api/status_view_test.exs | 1 | 
2 files changed, 51 insertions, 0 deletions
| diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 47a613837..cf60b4a51 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -420,4 +420,54 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do      assert [status] = json_response(conn, 200)      assert status["id"] == to_string(activity.id)    end + +  describe "updating credentials" do +    test "updates the user's bio" do +      user = insert(:user) + +      conn = conn +      |> assign(:user, user) +      |> patch("/api/v1/accounts/update_credentials", %{"note" => "I drink #cofe"}) + +      assert user = json_response(conn, 200) +      assert user["note"] == "I drink #cofe" +    end + +    test "updates the user's name" do +      user = insert(:user) + +      conn = conn +      |> assign(:user, user) +      |> patch("/api/v1/accounts/update_credentials", %{"display_name" => "markorepairs"}) + +      assert user = json_response(conn, 200) +      assert user["display_name"] == "markorepairs" +    end + +    test "updates the user's avatar" do +      user = insert(:user) + +      new_avatar = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"} + +      conn = conn +      |> 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" +    end + +    test "updates the user's banner" do +      user = insert(:user) + +      new_header = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"} + +      conn = conn +      |> 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" +    end +  end  end diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index 69d86ea82..601e551a9 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -103,5 +103,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do      assert represented[:id] == to_string(reblog.id)      assert represented[:reblog][:id] == to_string(activity.id) +    assert represented[:emojis] == []    end  end | 
