mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-01-03 05:48:42 +00:00
Fix the uploads migration mix task test which leaked a change to the configured Uploader
This commit is contained in:
parent
7388c4b5ca
commit
648e94b369
1 changed files with 16 additions and 1 deletions
|
@ -3,12 +3,14 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.UploadsTest do
|
defmodule Mix.Tasks.Pleroma.UploadsTest do
|
||||||
|
alias Pleroma.Config
|
||||||
alias Pleroma.Upload
|
alias Pleroma.Upload
|
||||||
use Pleroma.DataCase
|
use Pleroma.DataCase, async: false
|
||||||
|
|
||||||
import Mock
|
import Mock
|
||||||
|
|
||||||
setup_all do
|
setup_all do
|
||||||
|
prep_uploads()
|
||||||
Mix.shell(Mix.Shell.Process)
|
Mix.shell(Mix.Shell.Process)
|
||||||
|
|
||||||
on_exit(fn ->
|
on_exit(fn ->
|
||||||
|
@ -18,6 +20,8 @@ defmodule Mix.Tasks.Pleroma.UploadsTest do
|
||||||
: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
|
||||||
with_mock Upload,
|
with_mock Upload,
|
||||||
|
@ -53,4 +57,15 @@ defmodule Mix.Tasks.Pleroma.UploadsTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp prep_uploads() do
|
||||||
|
upload_dir = Config.get([Pleroma.Uploaders.Local, :uploads])
|
||||||
|
|
||||||
|
if not File.exists?(upload_dir) || File.ls!(upload_dir) == [] do
|
||||||
|
File.mkdir_p(upload_dir)
|
||||||
|
|
||||||
|
Path.join([upload_dir, "file.txt"])
|
||||||
|
|> File.touch()
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue