X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fuploaders%2Fs3_test.exs;h=d949c90a5c2ce183fb0a8d869a4f4edee1891ca4;hb=818f3c2393fb428997f783e599b0d629dcd5a842;hp=a0a1cfdf0a741293ed4b897ef4001142c8ada62f;hpb=bb9c53958038bb74ad76a9d887b15e6decb5249c;p=akkoma
diff --git a/test/uploaders/s3_test.exs b/test/uploaders/s3_test.exs
index a0a1cfdf0..d949c90a5 100644
--- a/test/uploaders/s3_test.exs
+++ b/test/uploaders/s3_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Uploaders.S3Test do
@@ -11,20 +11,11 @@ defmodule Pleroma.Uploaders.S3Test do
import Mock
import ExUnit.CaptureLog
- setup do
- config = Config.get([Pleroma.Uploaders.S3])
-
- Config.put([Pleroma.Uploaders.S3],
- bucket: "test_bucket",
- public_endpoint: "https://s3.amazonaws.com"
- )
-
- on_exit(fn ->
- Config.put([Pleroma.Uploaders.S3], config)
- end)
-
- :ok
- end
+ setup do:
+ clear_config(Pleroma.Uploaders.S3,
+ bucket: "test_bucket",
+ public_endpoint: "https://s3.amazonaws.com"
+ )
describe "get_file/1" do
test "it returns path to local folder for files" do
@@ -67,7 +58,7 @@ defmodule Pleroma.Uploaders.S3Test do
name: "image-tet.jpg",
content_type: "image/jpg",
path: "test_folder/image-tet.jpg",
- tempfile: Path.absname("test/fixtures/image_tmp.jpg")
+ tempfile: Path.absname("test/instance_static/add/shortcode.png")
}
[file_upload: file_upload]
@@ -87,4 +78,11 @@ defmodule Pleroma.Uploaders.S3Test do
end
end
end
+
+ describe "delete_file/1" do
+ test_with_mock "deletes file", ExAws, request: fn _req -> {:ok, %{status_code: 204}} end do
+ assert :ok = S3.delete_file("image.jpg")
+ assert_called(ExAws.request(:_))
+ end
+ end
end