summaryrefslogtreecommitdiff
path: root/test/user_test.exs
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-03-15 21:54:24 +0000
committerrinpatch <rinpatch@sdf.org>2020-03-15 21:54:24 +0000
commitbb49d8f5a0dbbad65a8f65a28cc2d0847b518067 (patch)
tree938fb7fd74053a816c21948b28d5f6cfb7443f37 /test/user_test.exs
parente8493431bfc16977e43715bf8bdb09ac46580028 (diff)
parent8d15d6c3ab9aecb82ba5126bb5efef20b3dfef41 (diff)
downloadpleroma-bb49d8f5a0dbbad65a8f65a28cc2d0847b518067.tar.gz
pleroma-bb49d8f5a0dbbad65a8f65a28cc2d0847b518067.zip
Merge branch 'release/2.0.1' into 'stable'
2.0.1 release See merge request pleroma/pleroma!2298
Diffstat (limited to 'test/user_test.exs')
-rw-r--r--test/user_test.exs19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/user_test.exs b/test/user_test.exs
index 84d7f5727..b07fed42b 100644
--- a/test/user_test.exs
+++ b/test/user_test.exs
@@ -412,7 +412,11 @@ defmodule Pleroma.UserTest do
assert activity.actor == welcome_user.ap_id
end
- test "it requires an email, name, nickname and password, bio is optional" do
+ clear_config([:instance, :account_activation_required])
+
+ test "it requires an email, name, nickname and password, bio is optional when account_activation_required is enabled" do
+ Pleroma.Config.put([:instance, :account_activation_required], true)
+
@full_user_data
|> Map.keys()
|> Enum.each(fn key ->
@@ -423,6 +427,19 @@ defmodule Pleroma.UserTest do
end)
end
+ test "it requires an name, nickname and password, bio and email are optional when account_activation_required is disabled" do
+ Pleroma.Config.put([:instance, :account_activation_required], false)
+
+ @full_user_data
+ |> Map.keys()
+ |> Enum.each(fn key ->
+ params = Map.delete(@full_user_data, key)
+ changeset = User.register_changeset(%User{}, params)
+
+ assert if key in [:bio, :email], do: changeset.valid?, else: not changeset.valid?
+ end)
+ end
+
test "it restricts certain nicknames" do
[restricted_name | _] = Pleroma.Config.get([User, :restricted_nicknames])