1 defmodule Mix.Tasks.Pleroma.UploadsTest do
8 Mix.shell(Mix.Shell.Process)
11 Mix.shell(Mix.Shell.IO)
17 describe "running migrate_local" do
18 test "uploads migrated" do
20 store: fn %Upload{name: _file, path: _path}, _opts -> {:ok, %{}} end do
21 Mix.Tasks.Pleroma.Uploads.run(["migrate_local", "S3"])
23 assert_received {:mix_shell, :info, [message]}
24 assert message =~ "Migrating files from local"
26 assert_received {:mix_shell, :info, [message]}
28 assert %{"total_count" => total_count} =
29 Regex.named_captures(~r"^Found (?<total_count>\d+) uploads$", message)
31 assert_received {:mix_shell, :info, [message]}
33 # @logevery in Mix.Tasks.Pleroma.Uploads
35 min(50, String.to_integer(total_count))
38 assert %{"count" => ^count, "total_count" => ^total_count} =
40 ~r"^Uploaded (?<count>\d+)/(?<total_count>\d+) files$",
46 test "nonexistent uploader" do
47 assert_raise RuntimeError, ~r/The uploader .* is not an existing/, fn ->
48 Mix.Tasks.Pleroma.Uploads.run(["migrate_local", "nonexistent"])