diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2019-09-12 09:26:45 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2019-09-12 09:26:45 +0200 |
commit | b1c10d2a0344f138a2208288e504c7478f74aa43 (patch) | |
tree | d659e2b5f2ec5b640426cec68f9565a19bb220ff /test | |
parent | Log Mnesia table type on creation (diff) |
Add support for XEP-0328: JID Prep
The mod_jidprep module implements XEP-0328: JID Prep, version 0.1.
Diffstat (limited to 'test')
-rw-r--r-- | test/ejabberd_SUITE.erl | 1 | ||||
-rw-r--r-- | test/ejabberd_SUITE_data/ejabberd.yml | 1 | ||||
-rw-r--r-- | test/jidprep_tests.erl | 62 |
3 files changed, 64 insertions, 0 deletions
diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl index 77d767a84..e67c6ca40 100644 --- a/test/ejabberd_SUITE.erl +++ b/test/ejabberd_SUITE.erl @@ -352,6 +352,7 @@ no_db_tests() -> auth_external_wrong_jid, auth_external_wrong_server, auth_external_invalid_cert, + jidprep_tests:single_cases(), sm_tests:single_cases(), sm_tests:master_slave_cases(), muc_tests:single_cases(), diff --git a/test/ejabberd_SUITE_data/ejabberd.yml b/test/ejabberd_SUITE_data/ejabberd.yml index 93c540b83..2bf090d5c 100644 --- a/test/ejabberd_SUITE_data/ejabberd.yml +++ b/test/ejabberd_SUITE_data/ejabberd.yml @@ -106,6 +106,7 @@ modules: vcard: VCARD mod_muc_admin: [] mod_carboncopy: [] + mod_jidprep: [] mod_mam: [] mod_last: [] mod_register: diff --git a/test/jidprep_tests.erl b/test/jidprep_tests.erl new file mode 100644 index 000000000..046f17b3c --- /dev/null +++ b/test/jidprep_tests.erl @@ -0,0 +1,62 @@ +%%%------------------------------------------------------------------- +%%% Author : Holger Weiss <holger@zedat.fu-berlin.de> +%%% Created : 11 Sep 2019 by Holger Weiss <holger@zedat.fu-berlin.de> +%%% +%%% +%%% ejabberd, Copyright (C) 2019 ProcessOne +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License along +%%% with this program; if not, write to the Free Software Foundation, Inc., +%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +%%% +%%%---------------------------------------------------------------------- + +-module(jidprep_tests). + +%% API +-compile(export_all). +-import(suite, [send_recv/2, disconnect/1, is_feature_advertised/2, + server_jid/1]). + +-include("suite.hrl"). + +%%%=================================================================== +%%% API +%%%=================================================================== +%%%=================================================================== +%%% Single user tests +%%%=================================================================== +single_cases() -> + {jidprep_single, [sequence], + [single_test(feature_enabled), + single_test(normalize_jid)]}. + +feature_enabled(Config) -> + true = is_feature_advertised(Config, ?NS_JIDPREP_0), + disconnect(Config). + +normalize_jid(Config) -> + ServerJID = server_jid(Config), + OrigJID = jid:decode(<<"Romeo@Example.COM/Orchard">>), + NormJID = jid:decode(<<"romeo@example.com/Orchard">>), + Request = #jidprep{jid = OrigJID}, + #iq{type = result, sub_els = [#jidprep{jid = NormJID}]} = + send_recv(Config, #iq{type = get, to = ServerJID, + sub_els = [Request]}), + disconnect(Config). + +%%%=================================================================== +%%% Internal functions +%%%=================================================================== +single_test(T) -> + list_to_atom("jidprep_" ++ atom_to_list(T)). |