From 3474066f6dc98003583dcd8537028b515be0e126 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 11 Mar 2019 15:18:32 +0100 Subject: MastoAPI Accounts: Add fetching by nickname. This is to make it easier for the frontends to handle domain.com/users/nickname urls. --- test/web/mastodon_api/mastodon_api_controller_test.exs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 8a20eef2c..8e14e03c8 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -1064,6 +1064,17 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert %{"error" => "Can't find user"} = json_response(conn, 404) end + test "account fetching also works nickname", %{conn: conn} do + user = insert(:user) + + conn = + conn + |> get("/api/v1/accounts/#{user.nickname}") + + assert %{"id" => id} = json_response(conn, 200) + assert id == user.id + end + test "media upload", %{conn: conn} do file = %Plug.Upload{ content_type: "image/jpg", @@ -1950,7 +1961,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do |> json_response(200) end - test "accound_id is required", %{ + test "account_id is required", %{ conn: conn, reporter: reporter, activity: activity -- cgit v1.2.3