aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mod_http_api_test.exs10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/mod_http_api_test.exs b/test/mod_http_api_test.exs
index adcb47061..cc5aed5a8 100644
--- a/test/mod_http_api_test.exs
+++ b/test/mod_http_api_test.exs
@@ -43,7 +43,15 @@ defmodule ModHttpApiTest do
{200, _, _} = :mod_http_api.process(["open_cmd"], request)
end
- test "Call to user, admin, restricted commands without authentication are rejected" do
+ # This related to the commands config file option
+ test "Attempting to access a command that is not exposed as HTTP API returns 401" do
+ :ejabberd_config.add_local_option(:commands, [])
+ request = request(method: :POST, data: "[]")
+ {401, _, _} = :mod_http_api.process(["open_cmd"], request)
+ end
+
+ test "Call to user commands without authentication are rejected" do
+ :ejabberd_config.add_local_option(:commands, [[{:add_commands, [:user_cmd]}]])
request = request(method: :POST, data: "[]")
{401, _, _} = :mod_http_api.process(["user_cmd"], request)
end