diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-12-06 17:05:09 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-12-06 17:05:09 +0700 |
commit | a75d4a41e03979b4d1b9af5205e457d714ff76df (patch) | |
tree | 174458f007f4ba8e92f76aba82e49f557b332f2b | |
parent | e4292cbfad47e59c76461fa201bab3e5f791962b (diff) | |
download | pleroma-a75d4a41e03979b4d1b9af5205e457d714ff76df.tar.gz |
Add a test for custom runtime modules
-rw-r--r-- | config/test.exs | 2 | ||||
-rw-r--r-- | lib/pleroma/application.ex | 8 | ||||
-rw-r--r-- | test/fixtures/modules/runtime_module.ex | 9 | ||||
-rw-r--r-- | test/runtime_test.exs | 11 |
4 files changed, 27 insertions, 3 deletions
diff --git a/config/test.exs b/config/test.exs index 9b737d4d7..8b9bf5c77 100644 --- a/config/test.exs +++ b/config/test.exs @@ -93,6 +93,8 @@ config :joken, default_signer: "yU8uHKq+yyAkZ11Hx//jcdacWc8yQ1bxAAGrplzB0Zwwjkp3 config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock +config :pleroma, :modules, runtime_dir: "test/fixtures/modules" + if File.exists?("./config/test.secret.exs") do import_config "test.secret.exs" else diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 17f6b9c80..82a005700 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -81,9 +81,11 @@ defmodule Pleroma.Application do raise "Invalid custom modules" {:ok, modules, _warnings} -> - Enum.each(modules, fn mod -> - IO.puts("Custom module loaded: #{inspect(mod)}") - end) + if @env != :test do + Enum.each(modules, fn mod -> + IO.puts("Custom module loaded: #{inspect(mod)}") + end) + end :ok end diff --git a/test/fixtures/modules/runtime_module.ex b/test/fixtures/modules/runtime_module.ex new file mode 100644 index 000000000..4711c3532 --- /dev/null +++ b/test/fixtures/modules/runtime_module.ex @@ -0,0 +1,9 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule RuntimeModule do + @moduledoc """ + This is a dummy module to test custom runtime modules. + """ +end diff --git a/test/runtime_test.exs b/test/runtime_test.exs new file mode 100644 index 000000000..f7b6f23d4 --- /dev/null +++ b/test/runtime_test.exs @@ -0,0 +1,11 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.RuntimeTest do + use ExUnit.Case, async: true + + test "it loads custom runtime modules" do + assert Code.ensure_compiled?(RuntimeModule) + end +end |