Forgot to fix one of the links in a test
[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
13 test "fixes an incorrect content type" do
14 file = %Plug.Upload{content_type: "application/octet-stream", path: Path.absname("test/fixtures/image.jpg"), filename: "an [image.jpg"}
15 data = Upload.store(file)
16 assert hd(data["url"])["mediaType"] == "image/jpeg"
17 end
18
19 test "does not modify a valid content type" do
20 file = %Plug.Upload{content_type: "image/png", path: Path.absname("test/fixtures/image.jpg"), filename: "an [image.jpg"}
21 data = Upload.store(file)
22 assert hd(data["url"])["mediaType"] == "image/png"
23 end
24 end
25 end