}
{:ok, %Activity{} = activity} = ActivityPub.insert(data)
- assert is_binary(activity.data["object"]["id"])
- assert %Object{} = Object.get_by_ap_id(activity.data["object"]["id"])
+ object = Object.normalize(activity.data["object"])
+
+ assert is_binary(object.data["id"])
+ assert %Object{} = Object.get_by_ap_id(activity.data["object"])
end
end
to: ["user1", "user1", "user2"],
actor: user,
context: "",
- object: %{}
+ object: %{
+ "to" => ["user1", "user1", "user2"],
+ "type" => "Note",
+ "content" => "testing"
+ }
})
assert activity.data["to"] == ["user1", "user2"]
end
end
+ describe "fetch the latest Follow" do
+ test "fetches the latest Follow activity" do
+ %Activity{data: %{"type" => "Follow"}} = activity = insert(:follow_activity)
+ follower = Repo.get_by(User, ap_id: activity.data["actor"])
+ followed = Repo.get_by(User, ap_id: activity.data["object"])
+
+ assert activity == Utils.fetch_latest_follow(follower, followed)
+ end
+ end
+
describe "fetching an object" do
test "it fetches an object" do
{:ok, object} =
end
end
- test "it can fetch plume articles" do
- {:ok, object} =
- ActivityPub.fetch_object_from_id(
- "https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/"
- )
-
- assert object
- end
-
describe "update" do
test "it creates an update activity with the new user data" do
user = insert(:user)