upload_test.exs 499 Bytes
Newer Older
lain's avatar
lain committed
1
2
3
4
5
6
defmodule Pleroma.UploadTest do
  alias Pleroma.Upload
  use Pleroma.DataCase

  describe "Storing a file" do
    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"}
lain's avatar
lain committed
8
      data = Upload.store(file)
9
10
      assert data["name"] == "an [image.jpg"
      assert List.first(data["url"])["href"] == "http://localhost:4001/media/#{data["uuid"]}/an%20%5Bimage.jpg"
lain's avatar
lain committed
11
12
13
    end
  end
end