25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Fix elixir tests

This commit is contained in:
Paweł Chmielowski 2017-02-27 12:44:24 +01:00
parent 719b4d1183
commit b1b3aba439
3 changed files with 12 additions and 9 deletions

View File

@ -42,26 +42,28 @@ defmodule EjabberdCommandsMockTest do
Record.defrecord :ejabberd_commands, Record.extract(:ejabberd_commands, from_lib: "ejabberd/include/ejabberd_commands.hrl") Record.defrecord :ejabberd_commands, Record.extract(:ejabberd_commands, from_lib: "ejabberd/include/ejabberd_commands.hrl")
setup_all do setup_all do
:ok = :ejabberd.start_app(:lager)
try do try do
:stringprep.start :stringprep.start
rescue rescue
_ -> :ok _ -> :ok
end end
:mnesia.start :mnesia.start
{:ok, _} = :jid.start {:ok, _} = :jid.start
:ejabberd_hooks.start_link :ejabberd_hooks.start_link
:ok = :ejabberd_config.start(["domain1", "domain2"], []) :ok = :ejabberd_config.start(["domain1", "domain2"], [])
{:ok, _} = :ejabberd_access_permissions.start_link() {:ok, _} = :ejabberd_access_permissions.start_link()
{:ok, _} = :acl.start_link {:ok, _} = :acl.start_link
EjabberdOauthMock.init EjabberdOauthMock.init
on_exit fn -> :meck.unload end on_exit fn -> :meck.unload end
end end
setup do setup do
:meck.unload :meck.unload
:meck.new(@module, [:non_strict]) :meck.new(@module, [:non_strict])
:mnesia.delete_table(:ejabberd_commands) :mnesia.delete_table(:ejabberd_commands)
:ejabberd_commands.start_link :ejabberd_commands.start_link
:ok
end end
test "API command can be registered, listed and unregistered" do test "API command can be registered, listed and unregistered" do

View File

@ -32,7 +32,7 @@ defmodule EjabberdCommandsTest do
:ok = :ejabberd_config.start(["localhost"], []) :ok = :ejabberd_config.start(["localhost"], [])
{:ok, _} = :ejabberd_access_permissions.start_link() {:ok, _} = :ejabberd_access_permissions.start_link()
:ejabberd_commands.init :ejabberd_commands.start_link
:ok :ok
end end

View File

@ -24,12 +24,13 @@ defmodule EjabberdCyrsaslTest do
use ExUnit.Case, async: true use ExUnit.Case, async: true
setup_all do setup_all do
:ok = :ejabberd.start_app(:lager)
:p1_sha.load_nif() :p1_sha.load_nif()
:mnesia.start :mnesia.start
:ok = start_module(:stringprep) :ok = start_module(:stringprep)
{:ok, _} = start_module(:jid) {:ok, _} = start_module(:jid)
:ok = :ejabberd_config.start(["domain1"], []) :ok = :ejabberd_config.start(["domain1"], [])
:ok = :cyrsasl.start_link {:ok, _} = :cyrsasl.start_link
cyrstate = :cyrsasl.server_new("domain1", "domain1", "domain1", :ok, &get_password/1, cyrstate = :cyrsasl.server_new("domain1", "domain1", "domain1", :ok, &get_password/1,
&check_password/3, &check_password_digest/5) &check_password/3, &check_password_digest/5)
setup_anonymous_mocks() setup_anonymous_mocks()