mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
Convert tests to Fast XML
This commit is contained in:
parent
dfc29ea03c
commit
89dda473cf
@ -94,8 +94,8 @@ init_stream(Config) ->
|
|||||||
ok = send_text(Config, io_lib:format(?STREAM_HEADER,
|
ok = send_text(Config, io_lib:format(?STREAM_HEADER,
|
||||||
[?config(server, Config)])),
|
[?config(server, Config)])),
|
||||||
{xmlstreamstart, <<"stream:stream">>, Attrs} = recv(),
|
{xmlstreamstart, <<"stream:stream">>, Attrs} = recv(),
|
||||||
<<"jabber:client">> = xml:get_attr_s(<<"xmlns">>, Attrs),
|
<<"jabber:client">> = fxml:get_attr_s(<<"xmlns">>, Attrs),
|
||||||
<<"1.0">> = xml:get_attr_s(<<"version">>, Attrs),
|
<<"1.0">> = fxml:get_attr_s(<<"version">>, Attrs),
|
||||||
#stream_features{sub_els = Fs} = recv(),
|
#stream_features{sub_els = Fs} = recv(),
|
||||||
Mechs = lists:flatmap(
|
Mechs = lists:flatmap(
|
||||||
fun(#sasl_mechanisms{list = Ms}) ->
|
fun(#sasl_mechanisms{list = Ms}) ->
|
||||||
@ -182,8 +182,8 @@ wait_auth_SASL_result(Config) ->
|
|||||||
io_lib:format(?STREAM_HEADER,
|
io_lib:format(?STREAM_HEADER,
|
||||||
[?config(server, Config)])),
|
[?config(server, Config)])),
|
||||||
{xmlstreamstart, <<"stream:stream">>, Attrs} = recv(),
|
{xmlstreamstart, <<"stream:stream">>, Attrs} = recv(),
|
||||||
<<"jabber:client">> = xml:get_attr_s(<<"xmlns">>, Attrs),
|
<<"jabber:client">> = fxml:get_attr_s(<<"xmlns">>, Attrs),
|
||||||
<<"1.0">> = xml:get_attr_s(<<"version">>, Attrs),
|
<<"1.0">> = fxml:get_attr_s(<<"version">>, Attrs),
|
||||||
#stream_features{sub_els = Fs} = recv(),
|
#stream_features{sub_els = Fs} = recv(),
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(#feature_sm{}, ConfigAcc) ->
|
fun(#feature_sm{}, ConfigAcc) ->
|
||||||
@ -255,7 +255,7 @@ send(State, Pkt) ->
|
|||||||
end,
|
end,
|
||||||
El = xmpp_codec:encode(NewPkt),
|
El = xmpp_codec:encode(NewPkt),
|
||||||
ct:pal("sent: ~p <-~n~s", [El, xmpp_codec:pp(NewPkt)]),
|
ct:pal("sent: ~p <-~n~s", [El, xmpp_codec:pp(NewPkt)]),
|
||||||
ok = send_text(State, xml:element_to_binary(El)),
|
ok = send_text(State, fxml:element_to_binary(El)),
|
||||||
NewID.
|
NewID.
|
||||||
|
|
||||||
send_recv(State, IQ) ->
|
send_recv(State, IQ) ->
|
||||||
@ -271,7 +271,7 @@ sasl_new(<<"DIGEST-MD5">>, User, Server, Password) ->
|
|||||||
case cyrsasl_digest:parse(ServerIn) of
|
case cyrsasl_digest:parse(ServerIn) of
|
||||||
bad -> {error, <<"Invalid SASL challenge">>};
|
bad -> {error, <<"Invalid SASL challenge">>};
|
||||||
KeyVals ->
|
KeyVals ->
|
||||||
Nonce = xml:get_attr_s(<<"nonce">>, KeyVals),
|
Nonce = fxml:get_attr_s(<<"nonce">>, KeyVals),
|
||||||
CNonce = id(),
|
CNonce = id(),
|
||||||
Realm = proplists:get_value(<<"realm">>, KeyVals, Server),
|
Realm = proplists:get_value(<<"realm">>, KeyVals, Server),
|
||||||
DigestURI = <<"xmpp/", Realm/binary>>,
|
DigestURI = <<"xmpp/", Realm/binary>>,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("p1_xml/include/xml.hrl").
|
-include_lib("fast_xml/include/fxml.hrl").
|
||||||
-include("ns.hrl").
|
-include("ns.hrl").
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("mod_proxy65.hrl").
|
-include("mod_proxy65.hrl").
|
||||||
|
Loading…
Reference in New Issue
Block a user