diff options
author | Mickael Remond <mremond@process-one.net> | 2016-03-30 15:59:29 +0200 |
---|---|---|
committer | Mickael Remond <mremond@process-one.net> | 2016-03-30 15:59:29 +0200 |
commit | 809057678b2872062ae052965bcc73dd0413b9b9 (patch) | |
tree | 726e262b513eb545ef18b9ba750da5abcf00dd3a /test | |
parent | Returns unauthorized error when we do not have correct credentials (diff) |
Better error report when command is not exposed through API
Diffstat (limited to 'test')
-rw-r--r-- | test/mod_http_api_test.exs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/mod_http_api_test.exs b/test/mod_http_api_test.exs index adcb4706..cc5aed5a 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 |