summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/status_controller_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-02-18 17:46:09 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-02-18 17:46:09 +0300
commit61d9f43e463a3b3b0c1e4b9c98c22e222797bd82 (patch)
treed0db351126377c4a648155df4dfdfd4358874b9c /test/web/mastodon_api/controllers/status_controller_test.exs
parent269d592181bff8601f6545b85158ee1c222ff20d (diff)
parent3fa2ac68df10f6ffe3c1ea76fa10c30da90f4bd0 (diff)
downloadpleroma-61d9f43e463a3b3b0c1e4b9c98c22e222797bd82.tar.gz
pleroma-61d9f43e463a3b3b0c1e4b9c98c22e222797bd82.zip
Merge remote-tracking branch 'remotes/origin/develop' into 1505-threads-federation
Diffstat (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs')
-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",