diff options
author | lain <lain@soykaf.club> | 2020-07-06 11:08:13 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-06 11:08:13 +0200 |
commit | af7720237b448341932a4a0b53d94b006114e915 (patch) | |
tree | f2ae2f4e47cb9173c7c20dc605416e1ce43bce8b /test | |
parent | c2a052a346d5104c3657343a885255d4d7179c75 (diff) | |
download | pleroma-af7720237b448341932a4a0b53d94b006114e915.tar.gz pleroma-af7720237b448341932a4a0b53d94b006114e915.zip |
Upload: Restrict description length
Diffstat (limited to 'test')
-rw-r--r-- | test/upload_test.exs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/upload_test.exs b/test/upload_test.exs index 2abf0edec..b06b54487 100644 --- a/test/upload_test.exs +++ b/test/upload_test.exs @@ -107,6 +107,19 @@ defmodule Pleroma.UploadTest do describe "Storing a file with the Local uploader" do setup [:ensure_local_uploader] + test "does not allow descriptions longer than the post limit" do + clear_config([:instance, :description_limit], 2) + 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" + } + + {:error, :description_too_long} = Upload.store(file, description: "123") + end + test "returns a media url" do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") |