1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Builders.UserBuilder do
9 def build(data \\ %{}) do
11 email: "test@example.org",
14 password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("test"),
17 last_digest_emailed_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second),
18 multi_factor_authentication_settings: %Pleroma.MFA.Settings{},
19 notification_settings: %Pleroma.User.NotificationSetting{}
25 def insert(data \\ %{}) do
26 {:ok, user} = Repo.insert(build(data))
27 User.invalidate_cache(user)