Allow admins request user backups

This commit is contained in:
Egor Kislitsyn 2020-09-18 22:18:34 +04:00
commit 7c22c9afb4
No known key found for this signature in database
GPG key ID: 1B49CB15B71E7805
6 changed files with 57 additions and 12 deletions

View file

@ -2024,6 +2024,27 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
response["status_visibility"]
end
end
describe "/api/pleroma/backups" do
test "it creates a backup", %{conn: conn} do
admin = insert(:user, is_admin: true)
token = insert(:oauth_admin_token, user: admin)
user = insert(:user)
assert "" ==
conn
|> assign(:user, admin)
|> assign(:token, token)
|> post("/api/pleroma/admin/backups", %{nickname: user.nickname})
|> json_response(200)
assert [backup] = Repo.all(Pleroma.Backup)
ObanHelpers.perform_all()
assert_email_sent(Pleroma.Emails.UserEmail.backup_is_ready_email(backup, admin.id))
end
end
end
# Needed for testing