From 87cc5a21105a257061cd46ca212d3514648db40e Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Fri, 4 Aug 2023 12:59:33 +0100 Subject: [PATCH] Fix uploads test being reliant on being run later --- test/mix/tasks/pleroma/uploads_test.exs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/mix/tasks/pleroma/uploads_test.exs b/test/mix/tasks/pleroma/uploads_test.exs index 4a6800099..67fb642c1 100644 --- a/test/mix/tasks/pleroma/uploads_test.exs +++ b/test/mix/tasks/pleroma/uploads_test.exs @@ -17,27 +17,29 @@ defmodule Mix.Tasks.Pleroma.UploadsTest do end) File.mkdir_p!("test/uploads") - :ok end + setup do: clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + describe "running migrate_local" do test "uploads migrated" do + File.copy!("test/fixtures/video.mp4", "test/uploads/video.mp4") + with_mock Upload, store: fn %Upload{name: _file, path: _path}, _opts -> {:ok, %{}} end do 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_receive {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]}, 1_000 assert %{"total_count" => total_count} = Regex.named_captures(~r"^Found (?\d+) uploads$", message) - assert_receive {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]}, 1_000 - # @logevery in Mix.Tasks.Pleroma.Uploads count = min(50, String.to_integer(total_count)) |> to_string()