25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +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")
setup_all do
:ok = :ejabberd.start_app(:lager)
try do
:stringprep.start
rescue
_ -> :ok
end
:mnesia.start
{:ok, _} = :jid.start
:ejabberd_hooks.start_link
:ok = :ejabberd_config.start(["domain1", "domain2"], [])
{:ok, _} = :ejabberd_access_permissions.start_link()
{:ok, _} = :acl.start_link
{:ok, _} = :jid.start
:ejabberd_hooks.start_link
:ok = :ejabberd_config.start(["domain1", "domain2"], [])
{:ok, _} = :ejabberd_access_permissions.start_link()
{:ok, _} = :acl.start_link
EjabberdOauthMock.init
on_exit fn -> :meck.unload end
on_exit fn -> :meck.unload end
end
setup do
:meck.unload
:meck.new(@module, [:non_strict])
:mnesia.delete_table(:ejabberd_commands)
:mnesia.delete_table(:ejabberd_commands)
:ejabberd_commands.start_link
:ok
end
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_access_permissions.start_link()
:ejabberd_commands.init
:ejabberd_commands.start_link
:ok
end

View File

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