summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2020-02-13 14:37:55 +0000
committerfeld <feld@feld.me>2020-02-13 14:37:55 +0000
commitb312c36b8e14b6aaa450bd8509e320c9784d0f48 (patch)
tree970f7522951f583f100f682142d7aa1b4e1082c3 /test
parent571a475c7ec8f9bb6e3a252aa7c3c65a1621bed6 (diff)
parent0db88f547b371fb480148279278bd081e5929003 (diff)
downloadpleroma-b312c36b8e14b6aaa450bd8509e320c9784d0f48.tar.gz
pleroma-b312c36b8e14b6aaa450bd8509e320c9784d0f48.zip
Merge branch 'develop' into 'fix/rename-no_attachment_links-setting'
# Conflicts: # config/description.exs
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/controllers/status_controller_test.exs26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs
index 83138d7ef..810f371cb 100644
--- a/test/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/web/mastodon_api/controllers/status_controller_test.exs
@@ -121,6 +121,32 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
NaiveDateTime.to_iso8601(expiration.scheduled_at)
end
+ test "it fails to create a status if `expires_in` is less or equal than an hour", %{
+ conn: conn
+ } do
+ # 1 hour
+ expires_in = 60 * 60
+
+ assert %{"error" => "Expiry date is too soon"} =
+ conn
+ |> post("api/v1/statuses", %{
+ "status" => "oolong",
+ "expires_in" => expires_in
+ })
+ |> json_response(422)
+
+ # 30 minutes
+ expires_in = 30 * 60
+
+ assert %{"error" => "Expiry date is too soon"} =
+ conn
+ |> post("api/v1/statuses", %{
+ "status" => "oolong",
+ "expires_in" => expires_in
+ })
+ |> json_response(422)
+ end
+
test "posting an undefined status with an attachment", %{user: user, conn: conn} do
file = %Plug.Upload{
content_type: "image/jpg",