expires_in in scheduled status params
This commit is contained in:
parent
8829a408ec
commit
1e6c27181e
6 changed files with 40 additions and 4 deletions
|
|
@ -383,6 +383,31 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
assert [] == Repo.all(Activity)
|
||||
end
|
||||
|
||||
test "with expiration" do
|
||||
%{conn: conn} = oauth_access(["write:statuses", "read:statuses"])
|
||||
|
||||
scheduled_at =
|
||||
NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(6), :millisecond)
|
||||
|> NaiveDateTime.to_iso8601()
|
||||
|> Kernel.<>("Z")
|
||||
|
||||
assert %{"id" => status_id, "params" => %{"expires_in" => 300}} =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/statuses", %{
|
||||
"status" => "scheduled",
|
||||
"scheduled_at" => scheduled_at,
|
||||
"expires_in" => 300
|
||||
})
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert %{"id" => ^status_id, "params" => %{"expires_in" => 300}} =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> get("/api/v1/scheduled_statuses/#{status_id}")
|
||||
|> json_response_and_validate_schema(200)
|
||||
end
|
||||
|
||||
test "ignores nil values", %{conn: conn} do
|
||||
conn =
|
||||
conn
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityViewTest do
|
|||
sensitive: true,
|
||||
spoiler_text: "spoiler",
|
||||
text: "hi",
|
||||
visibility: "unlisted"
|
||||
visibility: "unlisted",
|
||||
expires_in: nil
|
||||
},
|
||||
scheduled_at: Utils.to_masto_date(scheduled_activity.scheduled_at)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue