Add media upload endpoint.
This commit is contained in:
parent
3184939055
commit
641c24cdd4
4 changed files with 29 additions and 0 deletions
|
|
@ -213,4 +213,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
|||
|
||||
assert %{"error" => "Can't find user"} = json_response(conn, 404)
|
||||
end
|
||||
|
||||
test "media upload", %{conn: conn} do
|
||||
file = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg"}
|
||||
|
||||
user = insert(:user)
|
||||
|
||||
conn = conn
|
||||
|> assign(:user, user)
|
||||
|> post("/api/v1/media", %{"file" => file})
|
||||
|
||||
assert media = json_response(conn, 200)
|
||||
|
||||
assert media["type"] == "image"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -76,5 +76,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
|||
}
|
||||
|
||||
assert expected == StatusView.render("attachment.json", %{attachment: object})
|
||||
|
||||
# If theres a "id", use that instead of the generated one
|
||||
object = Map.put(object, "id", 2)
|
||||
assert %{id: 2} = StatusView.render("attachment.json", %{attachment: object})
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue