1 defmodule Pleroma.Factory do
2 use ExMachina.Ecto, repo: Pleroma.Repo
6 name: sequence(:name, &"Test ใในใ User #{&1}"),
7 email: sequence(:email, &"user#{&1}@example.com"),
8 nickname: sequence(:nickname, &"nick#{&1}"),
9 password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
10 bio: sequence(:bio, &"Tester Number #{&1}")
12 %{ user | ap_id: Pleroma.User.ap_id(user), follower_address: Pleroma.User.ap_followers(user) }
16 text = sequence(:text, &"This is :moominmamma: note #{&1}")
22 "id" => Pleroma.Web.ActivityPub.Utils.generate_object_id,
23 "actor" => user.ap_id,
24 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
25 "published" => DateTime.utc_now() |> DateTime.to_iso8601,
32 "2hu" => "corndog.png"
41 def note_activity_factory do
44 "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id,
46 "actor" => note.data["actor"],
47 "to" => note.data["to"],
48 "object" => note.data,
49 "published" => DateTime.utc_now() |> DateTime.to_iso8601,
50 "context" => note.data["context"]
58 def like_activity_factory do
59 note_activity = insert(:note_activity)
63 "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id,
64 "actor" => user.ap_id,
66 "object" => note_activity.data["object"]["id"],
67 "published_at" => DateTime.utc_now() |> DateTime.to_iso8601
75 def follow_activity_factory do
76 follower = insert(:user)
77 followed = insert(:user)
80 "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id,
81 "actor" => follower.ap_id,
83 "object" => followed.ap_id,
84 "published_at" => DateTime.utc_now() |> DateTime.to_iso8601
92 def websub_subscription_factory do
93 %Pleroma.Web.Websub.WebsubServerSubscription{
94 topic: "http://example.org",
95 callback: "http://example/org/callback",
96 secret: "here's a secret",
97 valid_until: NaiveDateTime.add(NaiveDateTime.utc_now, 100),
102 def websub_client_subscription_factory do
103 %Pleroma.Web.Websub.WebsubClientSubscription{
104 topic: "http://example.org",
105 secret: "here's a secret",