defmodule Pleroma.Factory do
use ExMachina.Ecto, repo: Pleroma.Repo
+ def participation_factory do
+ conversation = insert(:conversation)
+ user = insert(:user)
+
+ %Pleroma.Conversation.Participation{
+ conversation: conversation,
+ user: user,
+ read: false
+ }
+ end
+
+ def conversation_factory do
+ %Pleroma.Conversation{
+ ap_id: sequence(:ap_id, &"https://some_conversation/#{&1}")
+ }
+ end
+
def user_factory do
user = %Pleroma.User{
name: sequence(:name, &"Test ใในใ User #{&1}"),
def note_factory(attrs \\ %{}) do
text = sequence(:text, &"This is :moominmamma: note #{&1}")
- user = insert(:user)
+ user = attrs[:user] || insert(:user)
data = %{
"type" => "Note",
end
def note_activity_factory(attrs \\ %{}) do
- note = attrs[:note] || insert(:note)
+ user = attrs[:user] || insert(:user)
+ note = attrs[:note] || insert(:note, user: user)
data = %{
"id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(),
params: build(:note) |> Map.from_struct() |> Map.get(:data)
}
end
+
+ def registration_factory do
+ user = insert(:user)
+
+ %Pleroma.Registration{
+ user: user,
+ provider: "twitter",
+ uid: "171799000",
+ info: %{
+ "name" => "John Doe",
+ "email" => "john@doe.com",
+ "nickname" => "johndoe",
+ "description" => "My bio"
+ }
+ }
+ end
end