Skip to content

Commit c6c02d6

Browse files
committed
Allow to override start_connection
1 parent 00db574 commit c6c02d6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎src/escalus_client.erl‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
server/1,
3434
resource/1]).
3535

36+
%% Override
37+
-export([start_connection_default/4]).
38+
3639
-import(escalus_compat, [bin/1, unimplemented/0]).
3740

3841
-define(WAIT_FOR_STANZA_TIMEOUT, 1000).
@@ -47,7 +50,7 @@
4750
start(Config, UserSpec, Resource) ->
4851
EventClient = escalus_event:new_client(Config, UserSpec, Resource),
4952
Options = escalus_users:get_options(Config, UserSpec, Resource, EventClient),
50-
case escalus_connection:start(Options) of
53+
case start_connection(Config, UserSpec, Resource, Options) of
5154
{ok, Conn, Props, _} ->
5255
Jid = make_jid(Props),
5356
Client = #client{jid = Jid, conn = Conn, event_client = EventClient},
@@ -149,3 +152,11 @@ make_jid(Proplist) ->
149152
{server, S} = lists:keyfind(server, 1, Proplist),
150153
{resource, R} = lists:keyfind(resource, 1, Proplist),
151154
<<U/binary,"@",S/binary,"/",R/binary>>.
155+
156+
start_connection(Config, UserSpec, Resource, Options) ->
157+
escalus_overridables:do(Config, start_connection,
158+
[Config, UserSpec, Resource, Options],
159+
{?MODULE, start_connection_default}).
160+
161+
start_connection_default(_Config, _UserSpec, _Resource, Options) ->
162+
escalus_connection:start(Options).

0 commit comments

Comments
 (0)