aboutsummaryrefslogtreecommitdiff
path: root/test/ejabberd_SUITE.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2013-06-26 03:32:08 +1000
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2013-06-26 03:32:38 +1000
commit167f02ab724ecf346c0805014986acedd3208609 (patch)
tree88abc6d81961af0cc87c9f614e6a59d77e0368e4 /test/ejabberd_SUITE.erl
parentStart the LDAP server before ejabberd application (diff)
Do not fetch disco#info multiple times
Diffstat (limited to 'test/ejabberd_SUITE.erl')
-rw-r--r--test/ejabberd_SUITE.erl23
1 files changed, 15 insertions, 8 deletions
diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl
index cc6b9119d..845d9d428 100644
--- a/test/ejabberd_SUITE.erl
+++ b/test/ejabberd_SUITE.erl
@@ -660,7 +660,8 @@ stats(Config) ->
disconnect(Config).
pubsub(Config) ->
- true = is_feature_advertised(Config, ?NS_PUBSUB),
+ Features = get_features(Config, pubsub_jid(Config)),
+ true = lists:member(?NS_PUBSUB, Features),
%% Publish <presence/> element within node "presence"
ItemID = randoms:get_string(),
Node = <<"presence">>,
@@ -684,7 +685,7 @@ pubsub(Config) ->
#message{sub_els = [#pubsub_event{}, #delay{}]},
#iq{type = result, id = I1}),
%% Get subscriptions
- true = is_feature_advertised(Config, ?PUBSUB("retrieve-subscriptions")),
+ true = lists:member(?PUBSUB("retrieve-subscriptions"), Features),
#iq{type = result,
sub_els =
[#pubsub{subscriptions =
@@ -692,7 +693,7 @@ pubsub(Config) ->
send_recv(Config, #iq{type = get, to = pubsub_jid(Config),
sub_els = [#pubsub{subscriptions = {none, []}}]}),
%% Get affiliations
- true = is_feature_advertised(Config, ?PUBSUB("retrieve-affiliations")),
+ true = lists:member(?PUBSUB("retrieve-affiliations"), Features),
#iq{type = result,
sub_els = [#pubsub{
affiliations =
@@ -700,7 +701,7 @@ pubsub(Config) ->
send_recv(Config, #iq{type = get, to = pubsub_jid(Config),
sub_els = [#pubsub{affiliations = []}]}),
%% Get subscription options
- true = is_feature_advertised(Config, ?PUBSUB("subscription-options")),
+ true = lists:member(?PUBSUB("subscription-options"), Features),
#iq{type = result, sub_els = [#pubsub{options = #pubsub_options{
node = Node}}]} =
send_recv(Config,
@@ -717,7 +718,7 @@ pubsub(Config) ->
#iq{type = get, to = pubsub_jid(Config),
sub_els = [#pubsub{items = #pubsub_items{node = Node}}]}),
%% Deleting the item from the node
- true = is_feature_advertised(Config, ?PUBSUB("delete-items")),
+ true = lists:member(?PUBSUB("delete-items"), Features),
I2 = send(Config,
#iq{type = set, to = pubsub_jid(Config),
sub_els = [#pubsub{retract = #pubsub_retract{
@@ -1227,13 +1228,19 @@ id(undefined) ->
id(ID) ->
ID.
+get_features(Config) ->
+ get_features(Config, server_jid(Config)).
+
+get_features(Config, To) ->
+ #iq{type = result, sub_els = [#disco_info{features = Features}]} =
+ send_recv(Config, #iq{type = get, sub_els = [#disco_info{}], to = To}),
+ Features.
+
is_feature_advertised(Config, Feature) ->
is_feature_advertised(Config, Feature, server_jid(Config)).
is_feature_advertised(Config, Feature, To) ->
- ID = send(Config, #iq{type = get, sub_els = [#disco_info{}], to = To}),
- #iq{type = result, id = ID,
- sub_els = [#disco_info{feature = Features}]} = recv(),
+ Features = get_features(Config, To),
lists:member(Feature, Features).
bookmark_conference() ->