summaryrefslogtreecommitdiff
path: root/test/support/factory.ex
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-07-25 18:43:30 +0300
committerrinpatch <rinpatch@sdf.org>2019-07-25 18:43:30 +0300
commit41e0304757c5a0d9778f7e685c9ddf481f0e15cb (patch)
treedc60d86d41153d9764cb32a9adae5fa24894c1fa /test/support/factory.ex
parent196cad46f35a63c18d58cd5d982bc4e1f9b0d7c3 (diff)
parentd1e891062e3c6c34ca7940a476917beea2822ca2 (diff)
downloadpleroma-41e0304757c5a0d9778f7e685c9ddf481f0e15cb.tar.gz
pleroma-41e0304757c5a0d9778f7e685c9ddf481f0e15cb.zip
Merge branch 'develop' into feature/hide-follows-remote
Diffstat (limited to 'test/support/factory.ex')
-rw-r--r--test/support/factory.ex24
1 files changed, 14 insertions, 10 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex
index 531eb81e4..c751546ce 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -118,17 +118,21 @@ defmodule Pleroma.Factory do
def note_activity_factory(attrs \\ %{}) do
user = attrs[:user] || insert(:user)
note = attrs[:note] || insert(:note, user: user)
- attrs = Map.drop(attrs, [:user, :note])
- 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,