mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix tests
This commit is contained in:
parent
1ade88402c
commit
17f87eb899
@ -127,6 +127,8 @@ defmodule EjabberdCommandsMockTest do
|
|||||||
|
|
||||||
|
|
||||||
test "API command can be registered and executed" do
|
test "API command can be registered and executed" do
|
||||||
|
mock_commands_config
|
||||||
|
|
||||||
# Create & register a mocked command test() -> :result
|
# Create & register a mocked command test() -> :result
|
||||||
command_name = :test
|
command_name = :test
|
||||||
function = :test_command
|
function = :test_command
|
||||||
@ -142,6 +144,8 @@ defmodule EjabberdCommandsMockTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "API command with versions can be registered and executed" do
|
test "API command with versions can be registered and executed" do
|
||||||
|
mock_commands_config
|
||||||
|
|
||||||
command_name = :test
|
command_name = :test
|
||||||
|
|
||||||
function1 = :test_command1
|
function1 = :test_command1
|
||||||
@ -409,13 +413,13 @@ defmodule EjabberdCommandsMockTest do
|
|||||||
:meck.expect(:ejabberd_config, :get_myhosts,
|
:meck.expect(:ejabberd_config, :get_myhosts,
|
||||||
fn() -> [@domain] end)
|
fn() -> [@domain] end)
|
||||||
:meck.new :acl
|
:meck.new :acl
|
||||||
:meck.expect(:acl, :match_rule,
|
:meck.expect(:acl, :access_matches,
|
||||||
fn(@domain, :commands_admin_access, user) ->
|
fn(:commands_admin_access, info, _scope) ->
|
||||||
case :jlib.make_jid(@admin, @domain, "") do
|
case info do
|
||||||
^user -> :allow
|
%{usr: {@admin, @domain, _}} -> :allow
|
||||||
_ -> :deny
|
_ -> :deny
|
||||||
end
|
end;
|
||||||
(@domain, :all, _user) ->
|
(:all, _, _scope) ->
|
||||||
:allow
|
:allow
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user