X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=test%2Fpleroma%2Fuploaders%2Fs3_test.exs;h=2711e2c8df5911c165cdd58ca6a75f0d2bedcd97;hb=3897bb825ab0cd0a452676572eba79c0f4b5932b;hp=d949c90a5c2ce183fb0a8d869a4f4edee1891ca4;hpb=b738f709532ff18845f5d8cc3888d0bd67f750ab;p=akkoma
diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs
index d949c90a5..2711e2c8d 100644
--- a/test/pleroma/uploaders/s3_test.exs
+++ b/test/pleroma/uploaders/s3_test.exs
@@ -1,21 +1,21 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Uploaders.S3Test do
use Pleroma.DataCase
- alias Pleroma.Config
alias Pleroma.Uploaders.S3
import Mock
import ExUnit.CaptureLog
- setup do:
- clear_config(Pleroma.Uploaders.S3,
- bucket: "test_bucket",
- public_endpoint: "https://s3.amazonaws.com"
- )
+ setup do
+ clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3)
+ clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com")
+ clear_config([Pleroma.Uploaders.S3])
+ clear_config([Pleroma.Uploaders.S3, :bucket], "test_bucket")
+ end
describe "get_file/1" do
test "it returns path to local folder for files" do
@@ -26,12 +26,14 @@ defmodule Pleroma.Uploaders.S3Test do
end
test "it returns path without bucket when truncated_namespace set to ''" do
- Config.put([Pleroma.Uploaders.S3],
+ clear_config([Pleroma.Uploaders.S3],
bucket: "test_bucket",
- public_endpoint: "https://s3.amazonaws.com",
+ bucket_namespace: "myaccount",
truncated_namespace: ""
)
+ clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com")
+
assert S3.get_file("test_image.jpg") == {
:ok,
{:url, "https://s3.amazonaws.com/test_image.jpg"}
@@ -39,9 +41,8 @@ defmodule Pleroma.Uploaders.S3Test do
end
test "it returns path with bucket namespace when namespace is set" do
- Config.put([Pleroma.Uploaders.S3],
+ clear_config([Pleroma.Uploaders.S3],
bucket: "test_bucket",
- public_endpoint: "https://s3.amazonaws.com",
bucket_namespace: "family"
)
@@ -56,7 +57,7 @@ defmodule Pleroma.Uploaders.S3Test do
setup do
file_upload = %Pleroma.Upload{
name: "image-tet.jpg",
- content_type: "image/jpg",
+ content_type: "image/jpeg",
path: "test_folder/image-tet.jpg",
tempfile: Path.absname("test/instance_static/add/shortcode.png")
}