Pleroma/test/support/builders/user_builder.ex

20 lines
415 B
Elixir
Raw Normal View History

2017-03-21 17:53:20 +01:00
defmodule Pleroma.Builders.UserBuilder do
alias Pleroma.{User, Repo}
2017-03-22 16:51:20 +01:00
def build(data \\ %{}) do
user = %User{
2017-03-21 17:53:20 +01:00
email: "test@example.org",
name: "Test Name",
nickname: "testname",
password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
bio: "A tester.",
ap_id: "some id"
}
2017-03-22 16:51:20 +01:00
Map.merge(user, data)
2017-03-21 17:53:20 +01:00
end
2017-03-22 16:51:20 +01:00
def insert(data \\ %{}) do
Repo.insert(build(data))
2017-03-21 17:53:20 +01:00
end
end