MastoAPI Accounts: Add fetching by nickname.

This is to make it easier for the frontends to handle domain.com/users/nickname
urls.
This commit is contained in:
lain 2019-03-11 15:18:32 +01:00
commit 3474066f6d
3 changed files with 18 additions and 3 deletions

View file

@ -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