Fix tests relying on old behavior. Use the Upload.base_url, Luke.
This commit is contained in:
parent
c35e6fb516
commit
e87cca97e6
3 changed files with 13 additions and 8 deletions
|
@ -148,8 +148,8 @@ defmodule Pleroma.UploadTest do
|
||||||
{:ok, data} = Upload.store(file, filters: [Pleroma.Upload.Filter.Dedupe])
|
{:ok, data} = Upload.store(file, filters: [Pleroma.Upload.Filter.Dedupe])
|
||||||
|
|
||||||
assert List.first(data["url"])["href"] ==
|
assert List.first(data["url"])["href"] ==
|
||||||
Pleroma.Web.base_url() <>
|
Pleroma.Upload.base_url() <>
|
||||||
"/media/e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg"
|
"e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "copies the file to the configured folder without deduping" do
|
test "copies the file to the configured folder without deduping" do
|
||||||
|
|
|
@ -16,9 +16,12 @@ defmodule Pleroma.Uploaders.S3Test do
|
||||||
uploader: Pleroma.Uploaders.S3
|
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",
|
bucket: "test_bucket"
|
||||||
public_endpoint: "https://s3.amazonaws.com"
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,10 +36,11 @@ defmodule Pleroma.Uploaders.S3Test do
|
||||||
test "it returns path without bucket when truncated_namespace set to ''" do
|
test "it returns path without bucket when truncated_namespace set to ''" do
|
||||||
Config.put([Pleroma.Uploaders.S3],
|
Config.put([Pleroma.Uploaders.S3],
|
||||||
bucket: "test_bucket",
|
bucket: "test_bucket",
|
||||||
public_endpoint: "https://s3.amazonaws.com",
|
|
||||||
truncated_namespace: ""
|
truncated_namespace: ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Config.put([Pleroma.Upload], base_url: "https://s3.amazonaws.com")
|
||||||
|
|
||||||
assert S3.get_file("test_image.jpg") == {
|
assert S3.get_file("test_image.jpg") == {
|
||||||
:ok,
|
:ok,
|
||||||
{:url, "https://s3.amazonaws.com/test_image.jpg"}
|
{:url, "https://s3.amazonaws.com/test_image.jpg"}
|
||||||
|
@ -46,10 +50,11 @@ defmodule Pleroma.Uploaders.S3Test do
|
||||||
test "it returns path with bucket namespace when namespace is set" do
|
test "it returns path with bucket namespace when namespace is set" do
|
||||||
Config.put([Pleroma.Uploaders.S3],
|
Config.put([Pleroma.Uploaders.S3],
|
||||||
bucket: "test_bucket",
|
bucket: "test_bucket",
|
||||||
public_endpoint: "https://s3.amazonaws.com",
|
|
||||||
bucket_namespace: "family"
|
bucket_namespace: "family"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Config.put([Pleroma.Upload], base_url: "https://s3.amazonaws.com")
|
||||||
|
|
||||||
assert S3.get_file("test_image.jpg") == {
|
assert S3.get_file("test_image.jpg") == {
|
||||||
:ok,
|
:ok,
|
||||||
{:url, "https://s3.amazonaws.com/family:test_bucket/test_image.jpg"}
|
{:url, "https://s3.amazonaws.com/family:test_bucket/test_image.jpg"}
|
||||||
|
|
|
@ -196,11 +196,11 @@ defmodule Pleroma.User.BackupTest do
|
||||||
describe "it uploads and deletes a backup archive" do
|
describe "it uploads and deletes a backup archive" do
|
||||||
setup do
|
setup do
|
||||||
clear_config(Pleroma.Uploaders.S3,
|
clear_config(Pleroma.Uploaders.S3,
|
||||||
bucket: "test_bucket",
|
bucket: "test_bucket"
|
||||||
public_endpoint: "https://s3.amazonaws.com"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
clear_config([Pleroma.Upload, :uploader])
|
clear_config([Pleroma.Upload, :uploader])
|
||||||
|
clear_config([Pleroma.Upload, base_url: "https://s3.amazonaws.com"])
|
||||||
|
|
||||||
user = insert(:user, %{nickname: "cofe", name: "Cofe", ap_id: "http://cofe.io/users/cofe"})
|
user = insert(:user, %{nickname: "cofe", name: "Cofe", ap_id: "http://cofe.io/users/cofe"})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue