diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2021-01-26 16:55:44 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2021-02-01 14:11:12 +0300 |
commit | 2cb6dc5a3a3bd7e2326fe632a34b74cb150c5821 (patch) | |
tree | 9b995c97849cbde429df3317b32e1d71ad56b455 /test/support | |
parent | e21af1cfe48779427b6abf815022ebb88b6815d7 (diff) | |
download | pleroma-2cb6dc5a3a3bd7e2326fe632a34b74cb150c5821.tar.gz |
list timeline filtration by params
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/factory.ex | 31 |
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}") |