summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2024-03-15 19:32:35 +0000
committerfeld <feld@feld.me>2024-03-15 19:32:35 +0000
commit0b5bba23ce5661c25f813ef36f435e8f4aa333f1 (patch)
tree3c4bdc2d32bea0d348e9a67457b7b2e401dd37bf /test
parentdf7a8d4efe669c14775dd2bedf4b20dade6d7b66 (diff)
parentbb0b17f4d9a235f79b4b6fabdc5e3dbe472cd259 (diff)
downloadpleroma-0b5bba23ce5661c25f813ef36f435e8f4aa333f1.tar.gz
pleroma-0b5bba23ce5661c25f813ef36f435e8f4aa333f1.zip
Merge branch 'backups' into 'develop'
Include following/followers in backups See merge request pleroma/pleroma!4085
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/user/backup_test.exs13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs
index 0ac57e334..5503d15bc 100644
--- a/test/pleroma/user/backup_test.exs
+++ b/test/pleroma/user/backup_test.exs
@@ -166,6 +166,7 @@ defmodule Pleroma.User.BackupTest do
test "it creates a zip archive with user data" do
user = insert(:user, %{nickname: "cofe", name: "Cofe", ap_id: "http://cofe.io/users/cofe"})
+ %{ap_id: other_ap_id} = other_user = insert(:user)
{:ok, %{object: %{data: %{"id" => id1}}} = status1} =
CommonAPI.post(user, %{status: "status1"})
@@ -182,6 +183,8 @@ defmodule Pleroma.User.BackupTest do
Bookmark.create(user.id, status2.id)
Bookmark.create(user.id, status3.id)
+ CommonAPI.follow(user, other_user)
+
assert {:ok, backup} = user |> Backup.new() |> Repo.insert()
assert {:ok, path} = Backup.export(backup, self())
assert {:ok, zipfile} = :zip.zip_open(String.to_charlist(path), [:memory])
@@ -261,6 +264,16 @@ defmodule Pleroma.User.BackupTest do
"type" => "OrderedCollection"
} = Jason.decode!(json)
+ assert {:ok, {'following.json', json}} = :zip.zip_get('following.json', zipfile)
+
+ assert %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "id" => "following.json",
+ "orderedItems" => [^other_ap_id],
+ "totalItems" => 1,
+ "type" => "OrderedCollection"
+ } = Jason.decode!(json)
+
:zip.zip_close(zipfile)
File.rm!(path)
end