aboutsummaryrefslogtreecommitdiff
path: root/test/support
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2021-01-26 16:55:44 +0300
committerAlexander Strizhakov <alex.strizhakov@gmail.com>2021-02-01 14:11:12 +0300
commit2cb6dc5a3a3bd7e2326fe632a34b74cb150c5821 (patch)
tree9b995c97849cbde429df3317b32e1d71ad56b455 /test/support
parente21af1cfe48779427b6abf815022ebb88b6815d7 (diff)
downloadpleroma-2cb6dc5a3a3bd7e2326fe632a34b74cb150c5821.tar.gz
list timeline filtration by params
Diffstat (limited to 'test/support')
-rw-r--r--test/support/factory.ex31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex
index bf9592064..436e19409 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -104,6 +104,37 @@ defmodule Pleroma.Factory do
}
end
+ def attachment_note_factory(attrs \\ %{}) do
+ user = attrs[:user] || insert(:user)
+ {length, attrs} = Map.pop(attrs, :length, 1)
+
+ data = %{
+ "attachment" =>
+ Stream.repeatedly(fn -> attachment_data(user.ap_id, attrs[:href]) end)
+ |> Enum.take(length)
+ }
+
+ build(:note, Map.put(attrs, :data, data))
+ end
+
+ defp attachment_data(ap_id, href) do
+ href = href || sequence(:href, &"#{Pleroma.Web.Endpoint.url()}/media/#{&1}.jpg")
+
+ %{
+ "url" => [
+ %{
+ "href" => href,
+ "type" => "Link",
+ "mediaType" => "image/jpeg"
+ }
+ ],
+ "name" => "some name",
+ "type" => "Document",
+ "actor" => ap_id,
+ "mediaType" => "image/jpeg"
+ }
+ end
+
def audio_factory(attrs \\ %{}) do
text = sequence(:text, &"lain radio episode #{&1}")