Instance rules

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-02-05 18:03:53 +01:00
commit bd52e2aec7
9 changed files with 373 additions and 1 deletions

View file

@ -6,6 +6,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
# TODO: Should not need Cachex
use Pleroma.Web.ConnCase
alias Pleroma.Rule
alias Pleroma.User
import Pleroma.Factory
@ -39,7 +40,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
"banner_upload_limit" => _,
"background_image" => from_config_background,
"shout_limit" => _,
"description_limit" => _
"description_limit" => _,
"rules" => _
} = result
assert result["pleroma"]["metadata"]["account_activation_required"] != nil
@ -91,4 +93,18 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
assert ["peer1.com", "peer2.com"] == Enum.sort(result)
end
test "get instance rules", %{conn: conn} do
Rule.create(%{text: "Example rule"})
Rule.create(%{text: "Second rule"})
Rule.create(%{text: "Third rule"})
conn = get(conn, "/api/v1/instance")
assert result = json_response_and_validate_schema(conn, 200)
rules = result["rules"]
assert length(rules) == 3
end
end