Add a test

This commit is contained in:
Egor Kislitsyn 2020-02-18 17:09:50 +04:00
parent 2ef70b55f5
commit ca7ac068f0
No known key found for this signature in database
GPG key ID: 1B49CB15B71E7805

View file

@ -1254,4 +1254,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
assert [] = json_response(third_conn, 200) assert [] = json_response(third_conn, 200)
end 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 end