summaryrefslogtreecommitdiff
path: root/test/mod_http_api_mock_test.exs
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2017-07-06 17:19:05 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2017-07-06 17:19:22 +0200
commiteb9faffadda2de756a077e3538754ba29b1436e7 (patch)
tree72c1800b3919ab9d940223149b43fe58340f9325 /test/mod_http_api_mock_test.exs
parentHandle new possible result from ejabberd_config.add_option (diff)
Improve elixir tests
Diffstat (limited to 'test/mod_http_api_mock_test.exs')
-rw-r--r--test/mod_http_api_mock_test.exs19
1 files changed, 3 insertions, 16 deletions
diff --git a/test/mod_http_api_mock_test.exs b/test/mod_http_api_mock_test.exs
index 38337d95..ceda2bb0 100644
--- a/test/mod_http_api_mock_test.exs
+++ b/test/mod_http_api_mock_test.exs
@@ -45,10 +45,11 @@ defmodule ModHttpApiMockTest do
:jid.start
:mnesia.start
:ejabberd_mnesia.start
- :stringprep.start
+ :stringprep.start
+ :ejabberd_hooks.start_link
:ejabberd_config.start([@domain], [])
{:ok, _} = :ejabberd_access_permissions.start_link()
- :ejabberd_commands.init
+ :ejabberd_commands.start_link
rescue
_ -> :ok
end
@@ -79,10 +80,6 @@ defmodule ModHttpApiMockTest do
fn (@acommand, [], %{usr: {@user, @domain, _}}, @version) ->
:ok
end)
- :meck.expect(:ejabberd_commands, :execute_command,
- fn (:undefined, {@user, @domain, @userpass, false}, @acommand, [], @version, _) ->
- :ok
- end)
:ejabberd_config.add_local_option(:commands, [[{:add_commands, [@acommand]}]])
@@ -138,11 +135,6 @@ defmodule ModHttpApiMockTest do
(@acommand, [], %{usr: {@user, @domain, _}, oauth_scope: _}, @version) ->
throw({:error, :access_rules_unauthorized})
end)
- :meck.expect(:ejabberd_commands, :execute_command,
- fn (:undefined, {@user, @domain, {:oauth, _token}, false},
- @acommand, [], @version, _) ->
- :ok
- end)
# Correct OAuth call using specific scope
@@ -229,11 +221,6 @@ defmodule ModHttpApiMockTest do
end)
:meck.expect(:ejabberd_commands, :get_exposed_commands,
fn () -> [@acommand] end)
- :meck.expect(:ejabberd_commands, :execute_command,
- fn (:undefined, {@user, @domain, {:oauth, _token}, false},
- @acommand, [], @version, _) ->
- :ok
- end)
#Mock acl to allow oauth authorizations
:meck.expect(:acl, :match_rule, fn(_Server, _Access, _Jid) -> :allow end)