Access-Control-Allow-Origin
[akkoma] / test / support / factory.ex
index 3cf35e3bcda990add7b0b4a105a705466cc52bda..7f378915ed93c76ba525de0c8149e8e494cd53a6 100644 (file)
@@ -7,13 +7,13 @@ defmodule Pleroma.Factory do
       email: sequence(:email, &"user#{&1}@example.com"),
       nickname: sequence(:nickname, &"nick#{&1}"),
       password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
-      bio: sequence(:bio, &"Tester Number #{&1}"),
+      bio: sequence(:bio, &"Tester Number #{&1}")
     }
-    %{ user | ap_id: Pleroma.User.ap_id(user) }
+    %{ user | ap_id: Pleroma.User.ap_id(user), follower_address: Pleroma.User.ap_followers(user), following: [Pleroma.User.ap_id(user)] }
   end
 
   def note_factory do
-    text = sequence(:text, &"This is note #{&1}")
+    text = sequence(:text, &"This is :moominmamma: note #{&1}")
 
     user = insert(:user)
     data = %{
@@ -22,11 +22,15 @@ defmodule Pleroma.Factory do
       "id" => Pleroma.Web.ActivityPub.Utils.generate_object_id,
       "actor" => user.ap_id,
       "to" => ["https://www.w3.org/ns/activitystreams#Public"],
-      "published_at" => DateTime.utc_now() |> DateTime.to_iso8601,
+      "published" => DateTime.utc_now() |> DateTime.to_iso8601,
       "likes" => [],
       "like_count" => 0,
       "context" => "2hu",
-      "tag" => ["2hu"]
+      "summary" => "2hu",
+      "tag" => ["2hu"],
+      "emoji" => %{
+        "2hu" => "corndog.png"
+      }
     }
 
     %Pleroma.Object{
@@ -42,12 +46,13 @@ defmodule Pleroma.Factory do
       "actor" => note.data["actor"],
       "to" => note.data["to"],
       "object" => note.data,
-      "published_at" => DateTime.utc_now() |> DateTime.to_iso8601,
+      "published" => DateTime.utc_now() |> DateTime.to_iso8601,
       "context" => note.data["context"]
     }
 
     %Pleroma.Activity{
-      data: data
+      data: data,
+      actor: data["actor"]
     }
   end