]> granicus.if.org Git - ejabberd/commitdiff
Update MUC MAM tests
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 16 Apr 2018 13:10:44 +0000 (16:10 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 16 Apr 2018 13:10:44 +0000 (16:10 +0300)
test/mam_tests.erl

index daaf2419f5e5439de2bd48fd0a7f1ca295827dd2..ae21eaf60ed01b94835dcd98a7df5b5cd43f3ecd 100644 (file)
@@ -268,22 +268,11 @@ muc_master(Config) ->
     recv_messages_from_room(Config, lists:seq(2, 21)),
     %% Now enable MAM for the conference
     %% Retrieve config first
-    #iq{type = result, sub_els = [#muc_owner{config = #xdata{} = RoomCfg}]} =
-        send_recv(Config, #iq{type = get, sub_els = [#muc_owner{}],
-                              to = Room}),
-    %% Find the MAM field in the config and enable it
-    NewFields = lists:flatmap(
-                 fun(#xdata_field{var = <<"mam">> = Var}) ->
-                         [#xdata_field{var = Var, values = [<<"1">>]}];
-                    (_) ->
-                         []
-                 end, RoomCfg#xdata.fields),
-    NewRoomCfg = #xdata{type = submit, fields = NewFields},
-    #iq{type = result, sub_els = []} =
-       send_recv(Config, #iq{type = set, to = Room,
-                             sub_els = [#muc_owner{config = NewRoomCfg}]}),
-    #message{from = Room, type = groupchat,
-            sub_els = [#muc_user{status_codes = [104]}]} = recv_message(Config),
+    CfgOpts = muc_tests:get_config(Config),
+    %% Find the MAM field in the config
+    true = proplists:is_defined(mam, CfgOpts),
+    %% Enable MAM
+    [104] = muc_tests:set_config(Config, [{mam, true}]),
     %% Check if MAM has been enabled
     true = is_feature_advertised(Config, ?NS_MAM_1, Room),
     true = is_feature_advertised(Config, ?NS_MAM_2, Room),