X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fuser_test.exs;h=abc471d13ffddf1faba6359d6133b5fb1b026110;hb=f1abe39f6f5220eae6aad84a27a917b1d9bd4439;hp=d81c1b8eba94a7f4d7e6fe88f75b03640ce31139;hpb=15f87cf6589b40cc227b78b9d969203983ba6d02;p=akkoma diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index d81c1b8eb..abc471d13 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -151,7 +151,7 @@ defmodule Pleroma.UserTest do test "ap_id returns the activity pub id for the user" do user = UserBuilder.build() - expected_ap_id = "#{Pleroma.Web.base_url()}/users/#{user.nickname}" + expected_ap_id = "#{Pleroma.Web.Endpoint.url()}/users/#{user.nickname}" assert expected_ap_id == User.ap_id(user) end @@ -572,6 +572,24 @@ defmodule Pleroma.UserTest do ) end + test "it fails gracefully with invalid email config" do + cng = User.register_changeset(%User{}, @full_user_data) + + # Disable the mailer but enable all the things that want to send emails + clear_config([Pleroma.Emails.Mailer, :enabled], false) + clear_config([:instance, :account_activation_required], true) + clear_config([:instance, :account_approval_required], true) + clear_config([:welcome, :email, :enabled], true) + clear_config([:welcome, :email, :sender], "lain@lain.com") + + # The user is still created + assert {:ok, %User{nickname: "nick"}} = User.register(cng) + + # No emails are sent + ObanHelpers.perform_all() + refute_email_sent() + end + test "it requires an email, name, nickname and password, bio is optional when account_activation_required is enabled" do clear_config([:instance, :account_activation_required], true)