X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fsupport%2Ffactory.ex;h=9ef1b789c97b504a14b1a5e69f9c531d62daa8b1;hb=d2da3d30f3349946500423bab53e0c1221ab7b9b;hp=0e3c900c9b7f44e1d4b3a495f068ad2b008c45b9;hpb=75be90a6d177b00c4ca1083331975805c6f9afde;p=akkoma diff --git a/test/support/factory.ex b/test/support/factory.ex index 0e3c900c9..9ef1b789c 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -31,13 +31,15 @@ defmodule Pleroma.Factory do nickname: sequence(:nickname, &"nick#{&1}"), password_hash: Comeonin.Pbkdf2.hashpwsalt("test"), bio: sequence(:bio, &"Tester Number #{&1}"), - info: %{} + info: %{}, + last_digest_emailed_at: NaiveDateTime.utc_now() } %{ user | ap_id: User.ap_id(user), follower_address: User.ap_followers(user), + following_address: User.ap_following(user), following: [User.ap_id(user)] } end @@ -118,21 +120,27 @@ defmodule Pleroma.Factory do user = attrs[:user] || insert(:user) note = attrs[:note] || insert(:note, user: user) - data = %{ - "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(), - "type" => "Create", - "actor" => note.data["actor"], - "to" => note.data["to"], - "object" => note.data["id"], - "published" => DateTime.utc_now() |> DateTime.to_iso8601(), - "context" => note.data["context"] - } + data_attrs = attrs[:data_attrs] || %{} + attrs = Map.drop(attrs, [:user, :note, :data_attrs]) + + data = + %{ + "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(), + "type" => "Create", + "actor" => note.data["actor"], + "to" => note.data["to"], + "object" => note.data["id"], + "published" => DateTime.utc_now() |> DateTime.to_iso8601(), + "context" => note.data["context"] + } + |> Map.merge(data_attrs) %Pleroma.Activity{ data: data, actor: data["actor"], recipients: data["to"] } + |> Map.merge(attrs) end def article_activity_factory do