From e87cca97e62d8464c87c7335741f54c2299cc0d6 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 12 Jan 2021 16:35:10 -0600 Subject: [PATCH] Fix tests relying on old behavior. Use the Upload.base_url, Luke. --- test/pleroma/upload_test.exs | 4 ++-- test/pleroma/uploaders/s3_test.exs | 13 +++++++++---- test/pleroma/user/backup_test.exs | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/test/pleroma/upload_test.exs b/test/pleroma/upload_test.exs index f52d4dff6..cea161d8c 100644 --- a/test/pleroma/upload_test.exs +++ b/test/pleroma/upload_test.exs @@ -148,8 +148,8 @@ defmodule Pleroma.UploadTest do {:ok, data} = Upload.store(file, filters: [Pleroma.Upload.Filter.Dedupe]) assert List.first(data["url"])["href"] == - Pleroma.Web.base_url() <> - "/media/e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg" + Pleroma.Upload.base_url() <> + "e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg" end test "copies the file to the configured folder without deduping" do diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index 344cf7abe..f399f8ae5 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -16,9 +16,12 @@ defmodule Pleroma.Uploaders.S3Test do uploader: Pleroma.Uploaders.S3 ) + clear_config(Pleroma.Upload, + base_url: "https://s3.amazonaws.com" + ) + clear_config(Pleroma.Uploaders.S3, - bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com" + bucket: "test_bucket" ) end @@ -33,10 +36,11 @@ defmodule Pleroma.Uploaders.S3Test do test "it returns path without bucket when truncated_namespace set to ''" do Config.put([Pleroma.Uploaders.S3], bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com", truncated_namespace: "" ) + Config.put([Pleroma.Upload], base_url: "https://s3.amazonaws.com") + assert S3.get_file("test_image.jpg") == { :ok, {: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 Config.put([Pleroma.Uploaders.S3], bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com", bucket_namespace: "family" ) + Config.put([Pleroma.Upload], base_url: "https://s3.amazonaws.com") + assert S3.get_file("test_image.jpg") == { :ok, {:url, "https://s3.amazonaws.com/family:test_bucket/test_image.jpg"} diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index f68e4a029..01a1ed962 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -196,11 +196,11 @@ defmodule Pleroma.User.BackupTest do describe "it uploads and deletes a backup archive" do setup do clear_config(Pleroma.Uploaders.S3, - bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com" + bucket: "test_bucket" ) 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"})