summaryrefslogtreecommitdiff
path: root/test/support
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2021-08-09 09:37:59 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2021-08-09 09:37:59 +0000
commit6384d7803520f633a66d1cb9f76e3540863f92fb (patch)
tree93754d8c8a01c556c0fabca6ac3acdea3d4f02d3 /test/support
parentc45b3bde949bbbd6b8d6de30022c1d1e5b99dc44 (diff)
parentad09bdb3764e529d1f0682b5395f34bc4849bd22 (diff)
downloadpleroma-6384d7803520f633a66d1cb9f76e3540863f92fb.tar.gz
pleroma-6384d7803520f633a66d1cb9f76e3540863f92fb.zip
Merge branch 'simple_policy_reasons_for_instance_specific_policies' into 'develop'
Simple policy reasons for instance specific policies See merge request pleroma/pleroma!3314
Diffstat (limited to 'test/support')
-rw-r--r--test/support/factory.ex32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex
index c267dba4e..f31f64a50 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -142,6 +142,11 @@ defmodule Pleroma.Factory do
}
end
+ def followers_only_note_factory(attrs \\ %{}) do
+ %Pleroma.Object{data: data} = note_factory(attrs)
+ %Pleroma.Object{data: Map.merge(data, %{"to" => [data["actor"] <> "/followers"]})}
+ end
+
def audio_factory(attrs \\ %{}) do
text = sequence(:text, &"lain radio episode #{&1}")
@@ -267,6 +272,33 @@ defmodule Pleroma.Factory do
|> Map.merge(attrs)
end
+ def followers_only_note_activity_factory(attrs \\ %{}) do
+ user = attrs[:user] || insert(:user)
+ note = insert(:followers_only_note, user: user)
+
+ 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,
+ "published" => DateTime.utc_now() |> DateTime.to_iso8601(),
+ "context" => note.data["context"]
+ }
+ |> Map.merge(data_attrs)
+
+ %Pleroma.Activity{
+ data: data,
+ actor: data["actor"],
+ recipients: data["to"]
+ }
+ |> Map.merge(attrs)
+ end
+
def note_activity_factory(attrs \\ %{}) do
user = attrs[:user] || insert(:user)
note = attrs[:note] || insert(:note, user: user)