summaryrefslogtreecommitdiff
path: root/test/upload_test.exs
diff options
context:
space:
mode:
authorhref <href@random.sh>2018-11-30 17:44:12 +0100
committerhref <href@random.sh>2018-11-30 18:02:50 +0100
commit65e7307d6853064d9c09c80f1aca0c487001f9f4 (patch)
treea907ef2b5a97c4df66f3a9eddcd753fe9056b581 /test/upload_test.exs
parent5d924313507bcf7032f3460531da920f123d83c1 (diff)
downloadpleroma-65e7307d6853064d9c09c80f1aca0c487001f9f4.tar.gz
pleroma-65e7307d6853064d9c09c80f1aca0c487001f9f4.zip
Upload: bring back base_url
Diffstat (limited to 'test/upload_test.exs')
-rw-r--r--test/upload_test.exs18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/upload_test.exs b/test/upload_test.exs
index 7117373bd..cfd86ddd0 100644
--- a/test/upload_test.exs
+++ b/test/upload_test.exs
@@ -36,6 +36,24 @@ defmodule Pleroma.UploadTest do
assert String.starts_with?(url, Pleroma.Web.base_url() <> "/media/")
end
+ test "returns a media url with configured base_url" do
+ base_url = "https://cache.pleroma.social"
+
+ File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
+
+ file = %Plug.Upload{
+ content_type: "image/jpg",
+ path: Path.absname("test/fixtures/image_tmp.jpg"),
+ filename: "image.jpg"
+ }
+
+ {:ok, data} = Upload.store(file, base_url: base_url)
+
+ assert %{"url" => [%{"href" => url}]} = data
+
+ assert String.starts_with?(url, base_url <> "/media/")
+ end
+
test "copies the file to the configured folder with deduping" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")