aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkaniini <nenolod@gmail.com>2018-12-27 19:35:06 +0000
committerkaniini <nenolod@gmail.com>2018-12-27 19:35:06 +0000
commitcff0292d4b32cf51de8ad15281c35d783b137dd2 (patch)
treecbe9546e4f4aa76165818157b688d25e66bae66a /test
parent02866a42afde69f40724648757f6bdaab5a66d17 (diff)
parent1dd71026a1acd29e560f059d36f37ea70001bedb (diff)
downloadpleroma-cff0292d4b32cf51de8ad15281c35d783b137dd2.tar.gz
Merge branch 'reserve-user-names' into 'develop'
Reserve a few user names See merge request pleroma/pleroma!594
Diffstat (limited to 'test')
-rw-r--r--test/user_test.exs14
-rw-r--r--test/web/node_info_test.exs11
2 files changed, 25 insertions, 0 deletions
diff --git a/test/user_test.exs b/test/user_test.exs
index aab6473cf..8c7e1594b 100644
--- a/test/user_test.exs
+++ b/test/user_test.exs
@@ -153,6 +153,20 @@ defmodule Pleroma.UserTest do
end)
end
+ test "it restricts certain nicknames" do
+ [restricted_name | _] = Pleroma.Config.get([Pleroma.User, :restricted_nicknames])
+
+ assert is_bitstring(restricted_name)
+
+ params =
+ @full_user_data
+ |> Map.put(:nickname, restricted_name)
+
+ changeset = User.register_changeset(%User{}, params)
+
+ refute changeset.valid?
+ end
+
test "it sets the password_hash, ap_id and following fields" do
changeset = User.register_changeset(%User{}, @full_user_data)
diff --git a/test/web/node_info_test.exs b/test/web/node_info_test.exs
index 6769a4490..5981c70a7 100644
--- a/test/web/node_info_test.exs
+++ b/test/web/node_info_test.exs
@@ -19,6 +19,17 @@ defmodule Pleroma.Web.NodeInfoTest do
assert user.ap_id in result["metadata"]["staffAccounts"]
end
+ test "nodeinfo shows restricted nicknames", %{conn: conn} do
+ conn =
+ conn
+ |> get("/nodeinfo/2.0.json")
+
+ assert result = json_response(conn, 200)
+
+ assert Pleroma.Config.get([Pleroma.User, :restricted_nicknames]) ==
+ result["metadata"]["restrictedNicknames"]
+ end
+
test "returns 404 when federation is disabled", %{conn: conn} do
instance =
Application.get_env(:pleroma, :instance)