X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fpleroma%2Fweb%2Fmastodon_api%2Fupdate_credentials_test.exs;h=a5403f360ade71d0748623422c02a4e261b8948d;hb=db60640c5b91cd1ce2756565835673fa57afe082;hp=606467fa97a1436c3dfba47bf7d6e8eb18e362b0;hpb=5796d81d9877de51b2669da7d8f6fcc903c0ebda;p=akkoma diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs index 606467fa9..a5403f360 100644 --- a/test/pleroma/web/mastodon_api/update_credentials_test.exs +++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs @@ -209,6 +209,26 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do assert update_activity.data["object"]["name"] == "markorepairs" end + test "updates the user's default post expiry", %{conn: conn} do + conn = patch(conn, "/api/v1/accounts/update_credentials", %{"status_ttl_days" => "1"}) + + assert user_data = json_response_and_validate_schema(conn, 200) + assert user_data["akkoma"]["status_ttl_days"] == 1 + end + + test "resets the user's default post expiry", %{conn: conn} do + conn = patch(conn, "/api/v1/accounts/update_credentials", %{"status_ttl_days" => "-1"}) + + assert user_data = json_response_and_validate_schema(conn, 200) + assert is_nil(user_data["akkoma"]["status_ttl_days"]) + end + + test "does not allow negative integers other than -1 for TTL", %{conn: conn} do + conn = patch(conn, "/api/v1/accounts/update_credentials", %{"status_ttl_days" => "-2"}) + + assert json_response_and_validate_schema(conn, 403) + end + test "updates the user's AKAs", %{conn: conn} do conn = patch(conn, "/api/v1/accounts/update_credentials", %{