X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fuploaders%2Fs3_test.exs;h=6950ccb254ef13100a06e22a74d41a4e474c6e43;hb=c255c2e4f5e67a349ee379c8d93d853c12613b15;hp=a0a1cfdf0a741293ed4b897ef4001142c8ada62f;hpb=8778c16dac1789eeb6dd51524573163216200b5d;p=akkoma
diff --git a/test/uploaders/s3_test.exs b/test/uploaders/s3_test.exs
index a0a1cfdf0..6950ccb25 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
@@ -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