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
1 changed files with 19 additions and 0 deletions

View File

@ -1254,4 +1254,23 @@ test "returns the favorites of a user" 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