Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Waz committed Oct 11, 2022
1 parent fcfbef6 commit 3668310
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 963 deletions.
33 changes: 0 additions & 33 deletions test/acc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ groups() ->
store_retrieve_and_delete_many,
init_from_element,
produce_iq_meta_automatically,
strip,
strip_with_params,
parse_with_cdata
]
Expand Down Expand Up @@ -130,38 +129,6 @@ parse_with_cdata(_C) ->
{XMLNS, _} = mongoose_iq:xmlns(Acc),
?assertEqual(<<"jabber:iq:roster">>, XMLNS).

strip(_C) ->
El = iq_stanza(),
FromJID = jid:make(<<"jajid">>, <<"localhost">>, <<>>),
ToJID = jid:make(<<"tyjid">>, <<"localhost">>, <<>>),
Server = maps:get(lserver, ?ACC_PARAMS),
HostType = maps:get(host_type, ?ACC_PARAMS),
Acc = mongoose_acc:new(?ACC_PARAMS#{element => El,
from_jid => FromJID,
to_jid => ToJID}),
{XMLNS1, Acc1} = mongoose_iq:xmlns(Acc),
?assertEqual(<<"urn:ietf:params:xml:ns:xmpp-session">>, XMLNS1),
?assertEqual(<<"set">>, mongoose_acc:stanza_type(Acc1)),
?assertEqual(undefined, mongoose_acc:get(ns, ppp, undefined, Acc1)),
Acc2 = mongoose_acc:set_permanent(ns, ppp, 997, Acc1),
Acc3 = mongoose_acc:set(ns2, [{a, 1}, {b, 2}], Acc2),
?assertMatch([_, _], mongoose_acc:get(ns2, Acc3)),
?assertEqual(Server, mongoose_acc:lserver(Acc3)),
?assertEqual(HostType, mongoose_acc:host_type(Acc3)),
?assertEqual({FromJID, ToJID, El}, mongoose_acc:packet(Acc3)),
Ref = mongoose_acc:ref(Acc3),
%% strip stanza and check that only non-permanent fields are missing
NAcc1 = mongoose_acc:strip(Acc3),
{XMLNS3, NAcc2} = mongoose_iq:xmlns(NAcc1),
?assertEqual(<<"urn:ietf:params:xml:ns:xmpp-session">>, XMLNS3),
?assertEqual(<<"set">>, mongoose_acc:stanza_type(NAcc2)),
?assertEqual(Server, mongoose_acc:lserver(NAcc2)),
?assertEqual(HostType, mongoose_acc:host_type(NAcc2)),
?assertEqual({FromJID, ToJID, El}, mongoose_acc:packet(NAcc2)),
?assertEqual(Ref, mongoose_acc:ref(NAcc2)),
?assertEqual(997, mongoose_acc:get(ns, ppp, NAcc2)),
?assertEqual([], mongoose_acc:get(ns2, NAcc2)).

strip_with_params(_Config) ->
FromJID = jid:make(<<"jajid">>, <<"localhost">>, <<>>),
ToJID = jid:make(<<"tyjid">>, <<"localhost">>, <<>>),
Expand Down
6 changes: 3 additions & 3 deletions test/cowboy_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
-compile([export_all, nowarn_export_all]).

-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").

-define(SERVER, "http://localhost:8080").

Expand Down Expand Up @@ -221,9 +222,9 @@ start_cowboy_returns_error_eaddrinuse(_C) ->
handlers => [],
transport => default_config([listen, http, transport]),
protocol => default_config([listen, http, protocol])},
{ok, _Pid} = ejabberd_cowboy:start_cowboy(a_ref, Opts, 2, 10),
?assertMatch({ok, _}, ejabberd_cowboy:start_cowboy(a_ref, Opts, 2, 10)),
Result = ejabberd_cowboy:start_cowboy(a_ref_2, Opts, 2, 10),
{error, eaddrinuse} = Result.
?assertEqual({error, eaddrinuse}, Result).

%%--------------------------------------------------------------------
%% Helpers
Expand Down Expand Up @@ -391,4 +392,3 @@ ws_websocket_terminate(_Reason, _Req, no_ws_state) ->
assert_cowboy_handler_calls(M, F, Num) ->
Fun = fun() -> meck:num_calls(M, F, '_') end,
async_helper:wait_until(Fun, Num).

266 changes: 0 additions & 266 deletions test/ejabberd_c2s_SUITE.erl

This file was deleted.

Loading

0 comments on commit 3668310

Please sign in to comment.