mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Don't call deprecated jid functions from the test suite
This commit is contained in:
parent
8b29af629b
commit
0aa22e5149
@ -1025,7 +1025,7 @@ vcard_get(Config) ->
|
||||
disconnect(Config).
|
||||
|
||||
ldap_shared_roster_get(Config) ->
|
||||
Item = #roster_item{jid = jid:from_string(<<"user2@ldap.localhost">>), name = <<"Test User 2">>,
|
||||
Item = #roster_item{jid = jid:decode(<<"user2@ldap.localhost">>), name = <<"Test User 2">>,
|
||||
groups = [<<"group1">>], subscription = both},
|
||||
#iq{type = result, sub_els = [#roster_query{items = [Item]}]} =
|
||||
send_recv(Config, #iq{type = get, sub_els = [#roster_query{}]}),
|
||||
|
@ -94,8 +94,8 @@ get_set_prefs(Config) ->
|
||||
JID <- [undefined, server_jid(Config)],
|
||||
NS <- ?VERSIONS,
|
||||
Default <- [always, never, roster],
|
||||
Always <- [[], [jid:from_string(<<"foo@bar.baz">>)]],
|
||||
Never <- [[], [jid:from_string(<<"baz@bar.foo">>)]]],
|
||||
Always <- [[], [jid:decode(<<"foo@bar.baz">>)]],
|
||||
Never <- [[], [jid:decode(<<"baz@bar.foo">>)]]],
|
||||
lists:foreach(
|
||||
fun({To, Prefs}) ->
|
||||
NS = Prefs#mam_prefs.xmlns,
|
||||
@ -477,7 +477,7 @@ query_with(Config, From, To, NS) ->
|
||||
Range = lists:seq(1, 5),
|
||||
lists:foreach(
|
||||
fun(JID) ->
|
||||
ct:comment("Sending query with jid ~s", [jid:to_string(JID)]),
|
||||
ct:comment("Sending query with jid ~s", [jid:encode(JID)]),
|
||||
Query = if NS == ?NS_MAM_TMP ->
|
||||
#mam_query{xmlns = NS, with = JID, id = QID};
|
||||
true ->
|
||||
|
@ -191,14 +191,14 @@ service_disco_items(Config) ->
|
||||
|
||||
service_vcard(Config) ->
|
||||
MUC = muc_jid(Config),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:to_string(MUC)]),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:encode(MUC)]),
|
||||
#iq{type = result, sub_els = [#vcard_temp{}]} =
|
||||
send_recv(Config, #iq{type = get, to = MUC, sub_els = [#vcard_temp{}]}),
|
||||
disconnect(Config).
|
||||
|
||||
service_unique(Config) ->
|
||||
MUC = muc_jid(Config),
|
||||
ct:comment("Requesting muc unique from ~s", [jid:to_string(MUC)]),
|
||||
ct:comment("Requesting muc unique from ~s", [jid:encode(MUC)]),
|
||||
#iq{type = result, sub_els = [#muc_unique{name = Name}]} =
|
||||
send_recv(Config, #iq{type = get, to = MUC, sub_els = [#muc_unique{}]}),
|
||||
ct:comment("Checking if unique name is set in the response"),
|
||||
@ -1711,7 +1711,7 @@ destroy(Config, Reason) ->
|
||||
|
||||
disco_items(Config) ->
|
||||
MUC = muc_jid(Config),
|
||||
ct:comment("Performing disco#items request to ~s", [jid:to_string(MUC)]),
|
||||
ct:comment("Performing disco#items request to ~s", [jid:encode(MUC)]),
|
||||
#iq{type = result, from = MUC, sub_els = [DiscoItems]} =
|
||||
send_recv(Config, #iq{type = get, to = MUC,
|
||||
sub_els = [#disco_items{}]}),
|
||||
@ -1819,7 +1819,7 @@ get_affiliation(Config, Aff) ->
|
||||
|
||||
set_vcard(Config, VCard) ->
|
||||
Room = muc_room_jid(Config),
|
||||
ct:comment("Setting vCard for ~s", [jid:to_string(Room)]),
|
||||
ct:comment("Setting vCard for ~s", [jid:encode(Room)]),
|
||||
case send_recv(Config, #iq{type = set, to = Room,
|
||||
sub_els = [VCard]}) of
|
||||
#iq{type = result, sub_els = []} ->
|
||||
@ -1830,7 +1830,7 @@ set_vcard(Config, VCard) ->
|
||||
|
||||
get_vcard(Config) ->
|
||||
Room = muc_room_jid(Config),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:to_string(Room)]),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:encode(Room)]),
|
||||
case send_recv(Config, #iq{type = get, to = Room,
|
||||
sub_els = [#vcard_temp{}]}) of
|
||||
#iq{type = result, sub_els = [VCard]} ->
|
||||
|
@ -295,7 +295,7 @@ get_nodes(Config) ->
|
||||
MyJID = my_jid(Config),
|
||||
MyBareJID = jid:remove_resource(MyJID),
|
||||
Peer = ?config(peer, Config),
|
||||
Peer_s = jid:to_string(Peer),
|
||||
Peer_s = jid:encode(Peer),
|
||||
ct:comment("Getting headers"),
|
||||
#iq{type = result,
|
||||
sub_els = [#disco_items{
|
||||
|
@ -266,14 +266,14 @@ master_slave_cases() ->
|
||||
deny_bare_jid_master(Config) ->
|
||||
PeerJID = ?config(peer, Config),
|
||||
PeerBareJID = jid:remove_resource(PeerJID),
|
||||
deny_master(Config, {jid, jid:to_string(PeerBareJID)}).
|
||||
deny_master(Config, {jid, jid:encode(PeerBareJID)}).
|
||||
|
||||
deny_bare_jid_slave(Config) ->
|
||||
deny_slave(Config).
|
||||
|
||||
deny_full_jid_master(Config) ->
|
||||
PeerJID = ?config(peer, Config),
|
||||
deny_master(Config, {jid, jid:to_string(PeerJID)}).
|
||||
deny_master(Config, {jid, jid:encode(PeerJID)}).
|
||||
|
||||
deny_full_jid_slave(Config) ->
|
||||
deny_slave(Config).
|
||||
@ -781,7 +781,7 @@ server_send_iqs(Config) ->
|
||||
ServerJID = server_jid(Config),
|
||||
MyJID = my_jid(Config),
|
||||
ct:comment("Sending IQs from ~s to ~s",
|
||||
[jid:to_string(ServerJID), jid:to_string(MyJID)]),
|
||||
[jid:encode(ServerJID), jid:encode(MyJID)]),
|
||||
lists:foreach(
|
||||
fun(Type) ->
|
||||
ejabberd_router:route(
|
||||
@ -798,7 +798,7 @@ server_send_iqs(Config) ->
|
||||
|
||||
server_recv_iqs(Config) ->
|
||||
ServerJID = server_jid(Config),
|
||||
ct:comment("Receiving IQs from ~s", [jid:to_string(ServerJID)]),
|
||||
ct:comment("Receiving IQs from ~s", [jid:encode(ServerJID)]),
|
||||
lists:foreach(
|
||||
fun(Type) ->
|
||||
#iq{type = Type, from = ServerJID} = recv_iq(Config)
|
||||
@ -814,21 +814,21 @@ send_stanzas_to_server_resource(Config) ->
|
||||
ServerJIDResource = jid:replace_resource(ServerJID, <<"resource">>),
|
||||
%% All stanzas sent should be handled by local_send_to_resource_hook
|
||||
%% and should be bounced with item-not-found error
|
||||
ct:comment("Sending IQs to ~s", [jid:to_string(ServerJIDResource)]),
|
||||
ct:comment("Sending IQs to ~s", [jid:encode(ServerJIDResource)]),
|
||||
lists:foreach(
|
||||
fun(Type) ->
|
||||
#iq{type = error} = Err =
|
||||
send_recv(Config, #iq{type = Type, to = ServerJIDResource}),
|
||||
#stanza_error{reason = 'item-not-found'} = xmpp:get_error(Err)
|
||||
end, [set, get]),
|
||||
ct:comment("Sending messages to ~s", [jid:to_string(ServerJIDResource)]),
|
||||
ct:comment("Sending messages to ~s", [jid:encode(ServerJIDResource)]),
|
||||
lists:foreach(
|
||||
fun(Type) ->
|
||||
#message{type = error} = Err =
|
||||
send_recv(Config, #message{type = Type, to = ServerJIDResource}),
|
||||
#stanza_error{reason = 'item-not-found'} = xmpp:get_error(Err)
|
||||
end, [normal, chat, groupchat, headline]),
|
||||
ct:comment("Sending presences to ~s", [jid:to_string(ServerJIDResource)]),
|
||||
ct:comment("Sending presences to ~s", [jid:encode(ServerJIDResource)]),
|
||||
lists:foreach(
|
||||
fun(Type) ->
|
||||
#presence{type = error} = Err =
|
||||
|
@ -48,7 +48,7 @@ feature_enabled(Config) ->
|
||||
|
||||
service_vcard(Config) ->
|
||||
JID = proxy_jid(Config),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]),
|
||||
#iq{type = result, sub_els = [#vcard_temp{}]} =
|
||||
send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
|
||||
disconnect(Config).
|
||||
@ -106,7 +106,7 @@ master_slave_test(T) ->
|
||||
|
||||
socks5_connect(#streamhost{host = Host, port = Port},
|
||||
{SID, JID1, JID2}) ->
|
||||
Hash = p1_sha:sha([SID, jid:to_string(JID1), jid:to_string(JID2)]),
|
||||
Hash = p1_sha:sha([SID, jid:encode(JID1), jid:encode(JID2)]),
|
||||
{ok, Sock} = gen_tcp:connect(binary_to_list(Host), Port,
|
||||
[binary, {active, false}]),
|
||||
Init = <<?VERSION_5, 1, ?AUTH_ANONYMOUS>>,
|
||||
|
@ -85,7 +85,7 @@ test_features(Config) ->
|
||||
|
||||
test_vcard(Config) ->
|
||||
JID = pubsub_jid(Config),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]),
|
||||
#iq{type = result, sub_els = [#vcard_temp{}]} =
|
||||
send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
|
||||
disconnect(Config).
|
||||
|
@ -66,7 +66,7 @@ feature_enabled(Config) ->
|
||||
disconnect(Config).
|
||||
|
||||
set_item(Config) ->
|
||||
JID = jid:from_string(<<"nurse@example.com">>),
|
||||
JID = jid:decode(<<"nurse@example.com">>),
|
||||
Item = #roster_item{jid = JID},
|
||||
{V1, Item} = set_items(Config, [Item]),
|
||||
{V1, [Item]} = get_items(Config),
|
||||
@ -84,15 +84,15 @@ set_item(Config) ->
|
||||
del_roster(disconnect(Config), JID).
|
||||
|
||||
iq_set_many_items(Config) ->
|
||||
J1 = jid:from_string(<<"nurse1@example.com">>),
|
||||
J2 = jid:from_string(<<"nurse2@example.com">>),
|
||||
J1 = jid:decode(<<"nurse1@example.com">>),
|
||||
J2 = jid:decode(<<"nurse2@example.com">>),
|
||||
ct:comment("Trying to send roster-set with many <item/> elements"),
|
||||
Items = [#roster_item{jid = J1}, #roster_item{jid = J2}],
|
||||
#stanza_error{reason = 'bad-request'} = set_items(Config, Items),
|
||||
disconnect(Config).
|
||||
|
||||
iq_set_duplicated_groups(Config) ->
|
||||
JID = jid:from_string(<<"nurse@example.com">>),
|
||||
JID = jid:decode(<<"nurse@example.com">>),
|
||||
G = randoms:get_string(),
|
||||
ct:comment("Trying to send roster-set with duplicated groups"),
|
||||
Item = #roster_item{jid = JID, groups = [G, G]},
|
||||
@ -100,14 +100,14 @@ iq_set_duplicated_groups(Config) ->
|
||||
disconnect(Config).
|
||||
|
||||
iq_set_ask(Config) ->
|
||||
JID = jid:from_string(<<"nurse@example.com">>),
|
||||
JID = jid:decode(<<"nurse@example.com">>),
|
||||
ct:comment("Trying to send roster-set with 'ask' included"),
|
||||
Item = #roster_item{jid = JID, ask = subscribe},
|
||||
#stanza_error{reason = 'bad-request'} = set_items(Config, [Item]),
|
||||
disconnect(Config).
|
||||
|
||||
iq_get_item(Config) ->
|
||||
JID = jid:from_string(<<"nurse@example.com">>),
|
||||
JID = jid:decode(<<"nurse@example.com">>),
|
||||
ct:comment("Trying to send roster-get with <item/> element"),
|
||||
#iq{type = error} = Err3 =
|
||||
send_recv(Config, #iq{type = get,
|
||||
@ -117,7 +117,7 @@ iq_get_item(Config) ->
|
||||
disconnect(Config).
|
||||
|
||||
iq_unexpected_element(Config) ->
|
||||
JID = jid:from_string(<<"nurse@example.com">>),
|
||||
JID = jid:decode(<<"nurse@example.com">>),
|
||||
ct:comment("Trying to send IQs with unexpected element"),
|
||||
lists:foreach(
|
||||
fun(Type) ->
|
||||
@ -129,7 +129,7 @@ iq_unexpected_element(Config) ->
|
||||
disconnect(Config).
|
||||
|
||||
version(Config) ->
|
||||
JID = jid:from_string(<<"nurse@example.com">>),
|
||||
JID = jid:decode(<<"nurse@example.com">>),
|
||||
ct:comment("Requesting roster"),
|
||||
{InitialVersion, _} = get_items(Config, <<"">>),
|
||||
ct:comment("Requesting roster with initial version"),
|
||||
|
@ -689,7 +689,7 @@ get_features(Config) ->
|
||||
get_features(Config, server_jid(Config)).
|
||||
|
||||
get_features(Config, To) ->
|
||||
ct:comment("Getting features of ~s", [jid:to_string(To)]),
|
||||
ct:comment("Getting features of ~s", [jid:encode(To)]),
|
||||
#iq{type = result, sub_els = [#disco_info{features = Features}]} =
|
||||
send_recv(Config, #iq{type = get, sub_els = [#disco_info{}], to = To}),
|
||||
Features.
|
||||
@ -738,7 +738,7 @@ set_roster(Config, Subscription, Groups) ->
|
||||
PeerBareJID = jid:remove_resource(PeerJID),
|
||||
PeerLJID = jid:tolower(PeerBareJID),
|
||||
ct:comment("Adding ~s to roster with subscription '~s' in groups ~p",
|
||||
[jid:to_string(PeerBareJID), Subscription, Groups]),
|
||||
[jid:encode(PeerBareJID), Subscription, Groups]),
|
||||
{atomic, _} = mod_roster:set_roster(#roster{usj = {U, S, PeerLJID},
|
||||
us = {U, S},
|
||||
jid = PeerLJID,
|
||||
@ -754,7 +754,7 @@ del_roster(Config, PeerJID) ->
|
||||
{U, S, _} = jid:tolower(MyJID),
|
||||
PeerBareJID = jid:remove_resource(PeerJID),
|
||||
PeerLJID = jid:tolower(PeerBareJID),
|
||||
ct:comment("Removing ~s from roster", [jid:to_string(PeerBareJID)]),
|
||||
ct:comment("Removing ~s from roster", [jid:encode(PeerBareJID)]),
|
||||
{atomic, _} = mod_roster:del_roster(U, S, PeerLJID),
|
||||
Config.
|
||||
|
||||
|
@ -90,7 +90,7 @@ get_set(Config) ->
|
||||
|
||||
service_vcard(Config) ->
|
||||
JID = server_jid(Config),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
|
||||
ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]),
|
||||
#iq{type = result, sub_els = [#vcard_temp{}]} =
|
||||
send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
|
||||
disconnect(Config).
|
||||
|
Loading…
Reference in New Issue
Block a user