aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2020-08-31 20:31:21 +0400
committerEgor Kislitsyn <egor@kislitsyn.com>2020-10-07 18:34:28 +0400
commitbe42ab70dc9538df54ac6f30ee123666223b7287 (patch)
tree8d191ec1529c655f2cdd4195248b21aa85cb0bb9 /test
parentc82f9129592553718be4bd4712a2b1848dd0a447 (diff)
downloadpleroma-be42ab70dc9538df54ac6f30ee123666223b7287.tar.gz
Add backup upload
Diffstat (limited to 'test')
-rw-r--r--test/export_test.exs17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/export_test.exs b/test/export_test.exs
index 01ca8e7e8..fae269974 100644
--- a/test/export_test.exs
+++ b/test/export_test.exs
@@ -28,7 +28,7 @@ defmodule Pleroma.ExportTest do
Bookmark.create(user.id, status3.id)
assert {:ok, path} = Pleroma.Export.run(user)
- assert {:ok, zipfile} = :zip.zip_open(path, [:memory])
+ assert {:ok, zipfile} = :zip.zip_open(String.to_charlist(path), [:memory])
assert {:ok, {'actor.json', json}} = :zip.zip_get('actor.json', zipfile)
assert %{
@@ -108,4 +108,19 @@ defmodule Pleroma.ExportTest do
:zip.zip_close(zipfile)
File.rm!(path)
end
+
+ test "it uploads an exported backup archive" do
+ user = insert(:user, %{nickname: "cofe", name: "Cofe", ap_id: "http://cofe.io/users/cofe"})
+
+ {:ok, status1} = CommonAPI.post(user, %{status: "status1"})
+ {:ok, status2} = CommonAPI.post(user, %{status: "status2"})
+ {:ok, status3} = CommonAPI.post(user, %{status: "status3"})
+ CommonAPI.favorite(user, status1.id)
+ CommonAPI.favorite(user, status2.id)
+ Bookmark.create(user.id, status2.id)
+ Bookmark.create(user.id, status3.id)
+
+ assert {:ok, path} = Pleroma.Export.run(user)
+ assert {:ok, %Pleroma.Upload{}} = Pleroma.Export.upload(path)
+ end
end