@@ -9,9 +9,29 @@
|
||||
#
|
||||
# We recommend using the bang functions (`insert!`, `update!`
|
||||
# and so on) as they will fail if something goes wrong.
|
||||
import Logger
|
||||
|
||||
Eventos.Repo.delete_all Eventos.Accounts.User
|
||||
|
||||
Eventos.Accounts.User.registration_changeset(%Eventos.Accounts.User{}, %{email: "testuser@example.com", password: "secret", password_confirmation: "secret"})
|
||||
|> Eventos.Repo.insert!
|
||||
|
||||
{:ok, {privkey, pubkey}} = RsaEx.generate_keypair("4096")
|
||||
account = Ecto.Changeset.change(%Eventos.Accounts.Account{}, %{
|
||||
username: "tcit",
|
||||
description: "myaccount",
|
||||
display_name: "Thomas Citharel",
|
||||
domain: nil,
|
||||
private_key: privkey,
|
||||
public_key: pubkey,
|
||||
uri: "",
|
||||
url: ""
|
||||
})
|
||||
|
||||
user = Eventos.Accounts.User.registration_changeset(%Eventos.Accounts.User{}, %{
|
||||
email: "tcit@tcit.fr",
|
||||
password: "tcittcit",
|
||||
password_confirmation: "tcittcit"
|
||||
})
|
||||
|
||||
account_with_user = Ecto.Changeset.put_assoc(account, :user, user)
|
||||
|
||||
Eventos.Repo.insert!(account_with_user)
|
||||
|
||||
Reference in New Issue
Block a user