diff options
author | Alex Gleason <alex@alexgleason.me> | 2020-08-02 16:36:55 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2020-08-02 16:36:55 -0500 |
commit | 77b48cb4ce81165a3a4f28e91b8f22dd510d3d00 (patch) | |
tree | 3c09cdb626404c3b1843d22497dc2f32d05b8a9a /test/support/factory.ex | |
parent | 70951d042b5d7b12608a3f73a73c757fc4204449 (diff) | |
download | pleroma-77b48cb4ce81165a3a4f28e91b8f22dd510d3d00.tar.gz pleroma-77b48cb4ce81165a3a4f28e91b8f22dd510d3d00.zip |
Factory: Add report_activity_factory
Diffstat (limited to 'test/support/factory.ex')
-rw-r--r-- | test/support/factory.ex | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/support/factory.ex b/test/support/factory.ex index 635d83650..4c09d65b6 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -297,6 +297,30 @@ defmodule Pleroma.Factory do } end + def report_activity_factory(attrs \\ %{}) do + user = attrs[:user] || insert(:user) + activity = attrs[:activity] || insert(:note_activity) + state = attrs[:state] || "open" + + data = %{ + "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(), + "actor" => user.ap_id, + "type" => "Flag", + "object" => [activity.actor, activity.data["id"]], + "published" => DateTime.utc_now() |> DateTime.to_iso8601(), + "to" => [], + "cc" => [activity.actor], + "context" => activity.data["context"], + "state" => state, + } + + %Pleroma.Activity{ + data: data, + actor: data["actor"], + recipients: data["to"] ++ data["cc"] + } + end + def oauth_app_factory do %Pleroma.Web.OAuth.App{ client_name: sequence(:client_name, &"Some client #{&1}"), |