Fix uploads test being reliant on being run later
Some checks are pending
ci/woodpecker/push/build-amd64 Pipeline is pending
ci/woodpecker/push/build-arm64 Pipeline is pending
ci/woodpecker/push/docs Pipeline is pending
ci/woodpecker/push/test Pipeline is pending
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build-amd64 Pipeline was successful
ci/woodpecker/pr/build-arm64 Pipeline was successful
ci/woodpecker/pr/docs Pipeline was successful
Some checks are pending
ci/woodpecker/push/build-amd64 Pipeline is pending
ci/woodpecker/push/build-arm64 Pipeline is pending
ci/woodpecker/push/docs Pipeline is pending
ci/woodpecker/push/test Pipeline is pending
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build-amd64 Pipeline was successful
ci/woodpecker/pr/build-arm64 Pipeline was successful
ci/woodpecker/pr/docs Pipeline was successful
This commit is contained in:
parent
64e233ca20
commit
87cc5a2110
1 changed files with 7 additions and 5 deletions
|
@ -17,27 +17,29 @@ defmodule Mix.Tasks.Pleroma.UploadsTest do
|
||||||
end)
|
end)
|
||||||
|
|
||||||
File.mkdir_p!("test/uploads")
|
File.mkdir_p!("test/uploads")
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
setup do: clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
|
||||||
|
|
||||||
describe "running migrate_local" do
|
describe "running migrate_local" do
|
||||||
test "uploads migrated" do
|
test "uploads migrated" do
|
||||||
|
File.copy!("test/fixtures/video.mp4", "test/uploads/video.mp4")
|
||||||
|
|
||||||
with_mock Upload,
|
with_mock Upload,
|
||||||
store: fn %Upload{name: _file, path: _path}, _opts -> {:ok, %{}} end do
|
store: fn %Upload{name: _file, path: _path}, _opts -> {:ok, %{}} end do
|
||||||
Mix.Tasks.Pleroma.Uploads.run(["migrate_local", "S3"])
|
Mix.Tasks.Pleroma.Uploads.run(["migrate_local", "S3"])
|
||||||
|
|
||||||
assert_receive {:mix_shell, :info, [message]}
|
assert_receive {:mix_shell, :info, [message]}, 1_000
|
||||||
assert message =~ "Migrating files from local"
|
assert message =~ "Migrating files from local"
|
||||||
|
|
||||||
assert_receive {:mix_shell, :info, [message]}
|
assert_receive {:mix_shell, :info, [message]}, 1_000
|
||||||
|
|
||||||
assert %{"total_count" => total_count} =
|
assert %{"total_count" => total_count} =
|
||||||
Regex.named_captures(~r"^Found (?<total_count>\d+) uploads$", message)
|
Regex.named_captures(~r"^Found (?<total_count>\d+) uploads$", message)
|
||||||
|
|
||||||
assert_receive {:mix_shell, :info, [message]}
|
assert_receive {:mix_shell, :info, [message]}, 1_000
|
||||||
|
|
||||||
# @logevery in Mix.Tasks.Pleroma.Uploads
|
|
||||||
count =
|
count =
|
||||||
min(50, String.to_integer(total_count))
|
min(50, String.to_integer(total_count))
|
||||||
|> to_string()
|
|> to_string()
|
||||||
|
|
Loading…
Reference in a new issue