diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2020-02-13 20:43:34 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-02-13 20:43:34 +0300 |
commit | 6f9839c73c0d5068ff4505a2efddecf68fdb3bc3 (patch) | |
tree | ed158e0cd3c402cbc0f0dd6ce99d544ae634ca74 /test/web/mastodon_api/controllers/status_controller_test.exs | |
parent | da44ee5b0f6207666442b956ab2cdef3e5e9b49b (diff) | |
parent | 18a56410b821f1583d216dc55b9bd7b4d3a9c327 (diff) | |
download | pleroma-6f9839c73c0d5068ff4505a2efddecf68fdb3bc3.tar.gz pleroma-6f9839c73c0d5068ff4505a2efddecf68fdb3bc3.zip |
Merge branch 'develop' into issue/1276
Diffstat (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs')
-rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 26 |
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", |