diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2020-09-15 18:07:28 +0400 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2020-10-07 18:34:30 +0400 |
commit | 27bc121ec00a7b088030d6fb36c7e731f5b072b6 (patch) | |
tree | 343509c8c2aa99ca3882e7e979598e08e94adeac /test | |
parent | 386199063b9be9fc30ad403f6afb03bf6ca47298 (diff) | |
download | pleroma-27bc121ec00a7b088030d6fb36c7e731f5b072b6.tar.gz |
Require email
Diffstat (limited to 'test')
-rw-r--r-- | test/backup_test.exs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/backup_test.exs b/test/backup_test.exs index 5fc519eab..318c8c419 100644 --- a/test/backup_test.exs +++ b/test/backup_test.exs @@ -18,6 +18,18 @@ defmodule Pleroma.BackupTest do setup do clear_config([Pleroma.Upload, :uploader]) clear_config([Pleroma.Backup, :limit_days]) + clear_config([Pleroma.Emails.Mailer, :enabled]) + end + + test "it requries enabled email" do + Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], false) + user = insert(:user) + assert {:error, "Backups require enabled email"} == Backup.create(user) + end + + test "it requries user's email" do + user = insert(:user, %{email: nil}) + assert {:error, "Email is required"} == Backup.create(user) end test "it creates a backup record and an Oban job" do @@ -91,7 +103,7 @@ defmodule Pleroma.BackupTest do Bookmark.create(user.id, status3.id) assert {:ok, backup} = user |> Backup.new() |> Repo.insert() - assert {:ok, path} = Backup.zip(backup) + assert {:ok, path} = Backup.export(backup) assert {:ok, zipfile} = :zip.zip_open(String.to_charlist(path), [:memory]) assert {:ok, {'actor.json', json}} = :zip.zip_get('actor.json', zipfile) @@ -193,7 +205,7 @@ defmodule Pleroma.BackupTest do Bookmark.create(user.id, status3.id) assert {:ok, backup} = user |> Backup.new() |> Repo.insert() - assert {:ok, path} = Backup.zip(backup) + assert {:ok, path} = Backup.export(backup) [path: path, backup: backup] end |