1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpointTest do
8 import Pleroma.Tests.Helpers
11 setup do: clear_config(Pleroma.Upload)
12 setup do: clear_config(Pleroma.Uploaders.S3)
13 setup_all do: require_migration("20210113225652_deprecate_public_endpoint")
15 test "up/0 migrates public_endpoint to base_url", %{migration: migration} do
17 public_endpoint: "https://coolhost.com/",
18 bucket: "secret_bucket"
21 insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values)
24 uploader: Pleroma.Uploaders.S3
27 insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values)
31 assert [bucket: "secret_bucket"] ==
32 ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value
34 assert [uploader: Pleroma.Uploaders.S3, base_url: "https://coolhost.com/"] ==
35 ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value
38 test "down/0 reverts base_url to public_endpoint", %{migration: migration} do
40 bucket: "secret_bucket"
43 insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values)
46 uploader: Pleroma.Uploaders.S3,
47 base_url: "https://coolhost.com/"
50 insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values)
54 assert [bucket: "secret_bucket", public_endpoint: "https://coolhost.com/"] ==
55 ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value
57 assert [uploader: Pleroma.Uploaders.S3] ==
58 ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value