Merge branch 'oauth2' into 'develop'
[akkoma] / test / upload_test.exs
1 defmodule Pleroma.UploadTest do
2 alias Pleroma.Upload
3 use Pleroma.DataCase
4
5 describe "Storing a file" do
6 test "copies the file to the configured folder" do
7 file = %Plug.Upload{content_type: "image/jpg", path: Path.absname("test/fixtures/image.jpg"), filename: "an [image.jpg"}
8 data = Upload.store(file)
9 assert data["name"] == "an [image.jpg"
10 assert List.first(data["url"])["href"] == "http://localhost:4001/media/#{data["uuid"]}/an%20%5Bimage.jpg"
11 end
12 end
13 end