X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fuser_test.exs;h=b07fed42bac84b2eb9b0830887e0ad4f74893f4c;hb=bf474ca3c154544b54720ea23c06191e68f32522;hp=84d7f57274d5dcd87226f7c8ebc3594528d5a01f;hpb=4271cfb81a8983f5ec6a878cab1fb3fbd164245d;p=akkoma 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])