diff options
author | Maksim <parallel588@gmail.com> | 2019-07-23 19:15:48 +0000 |
---|---|---|
committer | kaniini <ariadne@dereferenced.org> | 2019-07-23 19:15:48 +0000 |
commit | c49a09ed88c3cef0f3df3e97cf4fa5367cd8f830 (patch) | |
tree | aabb395caf03a1a7508b49f4bbc73b32c66965ae /test/support/factory.ex | |
parent | 8d3cf7e519ddc0b5e89729d305120d2810e1e3eb (diff) | |
download | pleroma-c49a09ed88c3cef0f3df3e97cf4fa5367cd8f830.tar.gz |
tests for Pleroma.Web.ActivityPub.Publisher
Diffstat (limited to 'test/support/factory.ex')
-rw-r--r-- | test/support/factory.ex | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex index 531eb81e4..1f4239213 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -118,17 +118,20 @@ 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, |