diff options
author | Maxim Filippov <colixer@gmail.com> | 2019-11-25 01:43:11 +0900 |
---|---|---|
committer | Maxim Filippov <colixer@gmail.com> | 2019-11-25 01:43:11 +0900 |
commit | fd24467b923bd09850979600aeb9a46f8f0c7967 (patch) | |
tree | caed7d4448e3d89f796c92eed5c501690d8ee62a /test/web/node_info_test.exs | |
parent | 114930b5fd816657c21c5fbe33845fd3742c9c23 (diff) | |
parent | 937d6c6b32fc735cb5a56d9a3d97a6b2e8f37f68 (diff) | |
download | pleroma-fd24467b923bd09850979600aeb9a46f8f0c7967.tar.gz pleroma-fd24467b923bd09850979600aeb9a46f8f0c7967.zip |
Merge branch 'develop' into feature/admin-api-list-statuses-for-a-given-instance
Diffstat (limited to 'test/web/node_info_test.exs')
-rw-r--r-- | test/web/node_info_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/web/node_info_test.exs b/test/web/node_info_test.exs index 6cc876602..9a574a38d 100644 --- a/test/web/node_info_test.exs +++ b/test/web/node_info_test.exs @@ -61,6 +61,33 @@ defmodule Pleroma.Web.NodeInfoTest do assert Pleroma.Application.repository() == result["software"]["repository"] end + test "returns fieldsLimits field", %{conn: conn} do + max_account_fields = Pleroma.Config.get([:instance, :max_account_fields]) + max_remote_account_fields = Pleroma.Config.get([:instance, :max_remote_account_fields]) + account_field_name_length = Pleroma.Config.get([:instance, :account_field_name_length]) + account_field_value_length = Pleroma.Config.get([:instance, :account_field_value_length]) + + Pleroma.Config.put([:instance, :max_account_fields], 10) + Pleroma.Config.put([:instance, :max_remote_account_fields], 15) + Pleroma.Config.put([:instance, :account_field_name_length], 255) + Pleroma.Config.put([:instance, :account_field_value_length], 2048) + + response = + conn + |> get("/nodeinfo/2.1.json") + |> json_response(:ok) + + assert response["metadata"]["fieldsLimits"]["maxFields"] == 10 + assert response["metadata"]["fieldsLimits"]["maxRemoteFields"] == 15 + assert response["metadata"]["fieldsLimits"]["nameLength"] == 255 + assert response["metadata"]["fieldsLimits"]["valueLength"] == 2048 + + Pleroma.Config.put([:instance, :max_account_fields], max_account_fields) + Pleroma.Config.put([:instance, :max_remote_account_fields], max_remote_account_fields) + Pleroma.Config.put([:instance, :account_field_name_length], account_field_name_length) + Pleroma.Config.put([:instance, :account_field_value_length], account_field_value_length) + end + test "it returns the safe_dm_mentions feature if enabled", %{conn: conn} do option = Pleroma.Config.get([:instance, :safe_dm_mentions]) Pleroma.Config.put([:instance, :safe_dm_mentions], true) |