File: validation_test.exs

package info (click to toggle)
ejabberd 26.02-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,396 kB
  • sloc: erlang: 122,646; sh: 4,258; sql: 3,633; perl: 869; makefile: 559; javascript: 216; python: 48
file content (31 lines) | stat: -rw-r--r-- 853 bytes parent folder | download | duplicates (8)
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
defmodule Ejabberd.Config.ValidationTest do
  use ExUnit.Case

  alias Ejabberd.Config
  alias Ejabberd.Config.Store
  alias Ejabberd.Config.Validation

  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 "validates correctly the modules" do
    [mod_configure, mod_time] = Store.get(:modules)

    [{:error, _mod, errors}] = Validation.validate(mod_configure)
    assert %{dependency: [mod_adhoc: :not_found]} == errors

    [{:error, _mod, errors}] = Validation.validate(mod_time)
    assert %{attribute: [{{:attr_not_supported, true}, :attr_not_supported}]} == errors

  end
end