diff options
author | lain <lain@soykaf.club> | 2020-02-18 14:56:59 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-02-18 14:56:59 +0000 |
commit | cf8307e71c3f68bc26a540783a3ca26766b3b56c (patch) | |
tree | 27465edf4490c4ffefae5ad74fd14b4393fc4c81 /test | |
parent | 3fa2ac68df10f6ffe3c1ea76fa10c30da90f4bd0 (diff) | |
parent | ca7ac068f0d7e6b39f4563bbe8aa987449592909 (diff) | |
download | pleroma-cf8307e71c3f68bc26a540783a3ca26766b3b56c.tar.gz pleroma-cf8307e71c3f68bc26a540783a3ca26766b3b56c.zip |
Merge branch 'fix/status-view/expires_at' into 'develop'
Fix `status.expires_at` type
Closes #1573
See merge request pleroma/pleroma!2222
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 19 |
1 files changed, 19 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..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 |