diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-24 16:37:52 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-24 16:37:52 +0300 |
commit | d2da3d30f3349946500423bab53e0c1221ab7b9b (patch) | |
tree | 338d2e3b0412a9be89a462173e367495c5e9ad40 /test/support | |
parent | afc7708dbe00a70be616f00f01b22b0d01b9b61b (diff) | |
parent | 53fad36b57b61b28db595e445cd01fd6044dab6b (diff) | |
download | pleroma-d2da3d30f3349946500423bab53e0c1221ab7b9b.tar.gz |
Merge branch 'develop' into feature/digest-email
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/factory.ex | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex index c6a72521a..9ef1b789c 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -119,17 +119,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, |