summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/status_controller_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-02-20 15:00:48 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-02-20 15:00:48 +0300
commit0c65a8c3d02a5a9dc3a0a54fef3b86130cf3c0dd (patch)
tree0e0f2ad4f7317b44e11f1df4d2e5fc9a301007e1 /test/web/mastodon_api/controllers/status_controller_test.exs
parent343229465753ebcc59002a2dd604a910a8ce462d (diff)
parente0b2de63853e9a14b72faddf6e1180a098728205 (diff)
downloadpleroma-0c65a8c3d02a5a9dc3a0a54fef3b86130cf3c0dd.tar.gz
pleroma-0c65a8c3d02a5a9dc3a0a54fef3b86130cf3c0dd.zip
Merge remote-tracking branch 'remotes/origin/develop' into 1505-threads-federation
# Conflicts: # config/config.exs
Diffstat (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/status_controller_test.exs20
1 files changed, 20 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 810f371cb..781c3f7dc 100644
--- a/test/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/web/mastodon_api/controllers/status_controller_test.exs
@@ -21,6 +21,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
clear_config([:instance, :federating])
clear_config([:instance, :allow_relay])
+ clear_config([:rich_media, :enabled])
describe "posting statuses" do
setup do: oauth_access(["write:statuses"])
@@ -1254,4 +1255,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
assert [] = json_response(third_conn, 200)
end
+
+ test "expires_at is nil for another user" do
+ %{conn: conn, user: user} = oauth_access(["read:statuses"])
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "foobar", "expires_in" => 1_000_000})
+
+ expires_at =
+ activity.id
+ |> ActivityExpiration.get_by_activity_id()
+ |> Map.get(:scheduled_at)
+ |> NaiveDateTime.to_iso8601()
+
+ assert %{"pleroma" => %{"expires_at" => ^expires_at}} =
+ conn |> get("/api/v1/statuses/#{activity.id}") |> json_response(:ok)
+
+ %{conn: conn} = oauth_access(["read:statuses"])
+
+ assert %{"pleroma" => %{"expires_at" => nil}} =
+ conn |> get("/api/v1/statuses/#{activity.id}") |> json_response(:ok)
+ end
end