blob: d13f79aa62ddac721ed86c1629b302ab8b299a5b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
defmodule Ejabberd.Config.EjabberdLoggerTest do
use ExUnit.Case
import ExUnit.CaptureIO
alias Ejabberd.Config
alias Ejabberd.Config.Store
alias Ejabberd.Config.Validation
alias Ejabberd.Config.EjabberdLogger
setup_all do
pid = Process.whereis(Ejabberd.Config.Store)
unless pid != nil and Process.alive?(pid) do
Store.start_link
File.cd("test/elixir-config/shared")
config_file_path = File.cwd! <> "/ejabberd_for_validation.exs"
Config.init(config_file_path)
end
{:ok, %{}}
end
test "outputs correctly when attr is not supported" do
error_msg = "[ WARN ] Annotation @attr_not_supported is not supported.\n"
[_mod_irc, _mod_configure, mod_time] = Store.get(:modules)
fun = fn ->
mod_time
|> Validation.validate
|> EjabberdLogger.log_errors
end
assert capture_io(fun) == error_msg
end
test "outputs correctly when dependency is not found" do
error_msg = "[ WARN ] Module :mod_adhoc was not found, but is required as a dependency.\n"
[_mod_irc, mod_configure, _mod_time] = Store.get(:modules)
fun = fn ->
mod_configure
|> Validation.validate
|> EjabberdLogger.log_errors
end
assert capture_io(fun) == error_msg
end
end
|