summaryrefslogtreecommitdiff
path: root/test/user_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-03-12 12:07:07 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-03-12 12:07:07 +0300
commitbd40880fa0ed328c2948bb145354a8292fe051b5 (patch)
treed997a20a129cd72fe24c1f7169e1f6952339ce02 /test/user_test.exs
parent5b696a8ac1b5a06e60c2143cf88e014b28e14702 (diff)
parent00d17520314e3591caaa7ab4ca39c6227a6bdf15 (diff)
downloadpleroma-bd40880fa0ed328c2948bb145354a8292fe051b5.tar.gz
pleroma-bd40880fa0ed328c2948bb145354a8292fe051b5.zip
Merge remote-tracking branch 'remotes/origin/develop' into 1560-non-federating-instances-routes-restrictions
# Conflicts: # test/web/activity_pub/activity_pub_controller_test.exs
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])