From 4f8c3462a8821ffcf83f8b65edf48e55eff7080c Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 13 Feb 2020 21:55:47 +0300 Subject: Tweaks to `clear_config` calls in tests in order to prevent side effects on config during test suite execution. --- test/web/mastodon_api/controllers/status_controller_test.exs | 1 + 1 file changed, 1 insertion(+) (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs') diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index 810f371cb..4f467ac11 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"]) -- cgit v1.2.3 From ca7ac068f0d7e6b39f4563bbe8aa987449592909 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Tue, 18 Feb 2020 17:09:50 +0400 Subject: Add a test --- .../controllers/status_controller_test.exs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs') diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index 810f371cb..fd2e40ce2 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -1254,4 +1254,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 -- cgit v1.2.3