From 17f87eb89960499b2fbb3be6ac3f687b5d33ed1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Mon, 30 May 2016 21:45:12 +0200 Subject: [PATCH] Fix tests --- test/ejabberd_commands_mock_test.exs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/ejabberd_commands_mock_test.exs b/test/ejabberd_commands_mock_test.exs index 285585034..487cf6a4b 100644 --- a/test/ejabberd_commands_mock_test.exs +++ b/test/ejabberd_commands_mock_test.exs @@ -127,6 +127,8 @@ defmodule EjabberdCommandsMockTest do test "API command can be registered and executed" do + mock_commands_config + # Create & register a mocked command test() -> :result command_name = :test function = :test_command @@ -142,6 +144,8 @@ defmodule EjabberdCommandsMockTest do end test "API command with versions can be registered and executed" do + mock_commands_config + command_name = :test function1 = :test_command1 @@ -409,13 +413,13 @@ defmodule EjabberdCommandsMockTest do :meck.expect(:ejabberd_config, :get_myhosts, fn() -> [@domain] end) :meck.new :acl - :meck.expect(:acl, :match_rule, - fn(@domain, :commands_admin_access, user) -> - case :jlib.make_jid(@admin, @domain, "") do - ^user -> :allow - _ -> :deny - end - (@domain, :all, _user) -> + :meck.expect(:acl, :access_matches, + fn(:commands_admin_access, info, _scope) -> + case info do + %{usr: {@admin, @domain, _}} -> :allow + _ -> :deny + end; + (:all, _, _scope) -> :allow end) end