1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Config.LoaderTest do
6 use ExUnit.Case, async: true
8 alias Pleroma.Config.Loader
11 config = Loader.load("test/fixtures/config/temp.secret.exs")
12 assert config[:pleroma][:first_setting][:key] == "value"
13 assert config[:pleroma][:first_setting][:key2] == [Pleroma.Repo]
14 assert config[:quack][:level] == :info
17 test "load_and_merge/0" do
18 config = Loader.load_and_merge()
20 refute config[:pleroma][Pleroma.Repo]
21 refute config[:pleroma][Pleroma.Web.Endpoint]
22 refute config[:pleroma][:env]
23 refute config[:pleroma][:configurable_from_database]
24 refute config[:pleroma][:database]
25 refute config[:phoenix][:serve_endpoints]
27 assert config[:pleroma][:ecto_repos] == [Pleroma.Repo]
28 assert config[:pleroma][Pleroma.Uploaders.Local][:uploads] == "test/uploads"
29 assert config[:tesla][:adapter] == Tesla.Mock
32 test "filter_group/2" do
33 assert Loader.filter_group(:pleroma,
35 {Pleroma.Repo, [a: 1, b: 2]},
36 {Pleroma.Upload, [a: 1, b: 2]},
37 {Pleroma.Web.Endpoint, []},
39 configurable_from_database: true,
42 ) == [{Pleroma.Upload, [a: 1, b: 2]}]