Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 line
1.7KB

  1. defmodule Pleroma.Config.ReleaseRuntimeProviderTest do
  2. use ExUnit.Case, async: true
  3. alias Pleroma.Config.ReleaseRuntimeProvider
  4. describe "load/2" do
  5. test "loads release defaults config and warns about non-existent runtime config" do
  6. ExUnit.CaptureIO.capture_io(fn ->
  7. merged = ReleaseRuntimeProvider.load([], [])
  8. assert merged == Pleroma.Config.Holder.release_defaults()
  9. end) =~
  10. "!!! Config path is not declared! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file"
  11. end
  12. test "merged runtime config" do
  13. merged =
  14. ReleaseRuntimeProvider.load([], config_path: "test/fixtures/config/temp.secret.exs")
  15. assert merged[:pleroma][:first_setting] == [key: "value", key2: [Pleroma.Repo]]
  16. assert merged[:pleroma][:second_setting] == [key: "value2", key2: ["Activity"]]
  17. end
  18. test "merged exported config" do
  19. ExUnit.CaptureIO.capture_io(fn ->
  20. merged =
  21. ReleaseRuntimeProvider.load([],
  22. exported_config_path: "test/fixtures/config/temp.exported_from_db.secret.exs"
  23. )
  24. assert merged[:pleroma][:exported_config_merged]
  25. end) =~
  26. "!!! Config path is not declared! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file"
  27. end
  28. test "runtime config is merged with exported config" do
  29. merged =
  30. ReleaseRuntimeProvider.load([],
  31. config_path: "test/fixtures/config/temp.secret.exs",
  32. exported_config_path: "test/fixtures/config/temp.exported_from_db.secret.exs"
  33. )
  34. assert merged[:pleroma][:first_setting] == [key2: [Pleroma.Repo], key: "new value"]
  35. end
  36. end
  37. end