summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-07-07 03:00:52 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-07-07 03:00:52 +0000
commitd81acb5f6250766eef1dc8c51ed0c79e819ae2af (patch)
treed54e27b8306f5323d434d54639ca38a5f9c874d5 /test
parent2a323d37971d364fefd46e840424c631cc4a7d2b (diff)
parent58da575935f19b86c614717f4fe0d4b8508f395d (diff)
downloadpleroma-d81acb5f6250766eef1dc8c51ed0c79e819ae2af.tar.gz
pleroma-d81acb5f6250766eef1dc8c51ed0c79e819ae2af.zip
Merge branch 'description-limits' into 'develop'
Add limits to image descriptions See merge request pleroma/pleroma!2724
Diffstat (limited to 'test')
-rw-r--r--test/upload_test.exs13
-rw-r--r--test/web/mastodon_api/controllers/instance_controller_test.exs4
2 files changed, 16 insertions, 1 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")
diff --git a/test/web/mastodon_api/controllers/instance_controller_test.exs b/test/web/mastodon_api/controllers/instance_controller_test.exs
index 95ee26416..cc880d82c 100644
--- a/test/web/mastodon_api/controllers/instance_controller_test.exs
+++ b/test/web/mastodon_api/controllers/instance_controller_test.exs
@@ -32,7 +32,9 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
"avatar_upload_limit" => _,
"background_upload_limit" => _,
"banner_upload_limit" => _,
- "background_image" => _
+ "background_image" => _,
+ "chat_limit" => _,
+ "description_limit" => _
} = result
assert result["pleroma"]["metadata"]["account_activation_required"] != nil