summaryrefslogtreecommitdiff
path: root/test/support/factory.ex
diff options
context:
space:
mode:
Diffstat (limited to 'test/support/factory.ex')
-rw-r--r--test/support/factory.ex12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex
index efbf3df2e..b01aff3ab 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -111,6 +111,18 @@ defmodule Pleroma.Factory do
}
end
+ def attachment_factory(attrs \\ %{}) do
+ user = attrs[:user] || insert(:user)
+
+ data =
+ attachment_data(user.ap_id, nil)
+ |> Map.put("id", Pleroma.Web.ActivityPub.Utils.generate_object_id())
+
+ %Pleroma.Object{
+ data: merge_attributes(data, Map.get(attrs, :data, %{}))
+ }
+ end
+
def attachment_note_factory(attrs \\ %{}) do
user = attrs[:user] || insert(:user)
{length, attrs} = Map.pop(attrs, :length, 1)