Skip to content

Commit

Permalink
Merge pull request #4398 from esl/test-mam-without-prefs
Browse files Browse the repository at this point in the history
Test MAM without prefs
  • Loading branch information
gustawlippa authored Nov 15, 2024
2 parents d4bc662 + 14b13b2 commit de22c49
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion big_tests/tests/mam_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ rdbms_configs(true, mnesia) ->
];
rdbms_configs(true, cets) ->
[rdbms,
rdbms_no_prefs,
rdbms_easy,
rdbms_async_pool,
rdbms_async_cache,
Expand All @@ -199,6 +200,7 @@ basic_group_names() ->
muc_light,
prefs_cases,
muc_prefs_cases,
no_prefs_cases,
impl_specific,
disabled_text_search,
disabled_complex_queries,
Expand Down Expand Up @@ -233,6 +235,10 @@ groups() ->
|| C <- configurations(), {G, Props, Tests} <- basic_groups(),
not is_skipped(C, G)].

is_skipped(rdbms_no_prefs, G) ->
G =:= prefs_cases orelse G =:= muc_prefs_cases;
is_skipped(_, no_prefs_cases) ->
true;
is_skipped(_, _) ->
false.

Expand Down Expand Up @@ -275,6 +281,7 @@ basic_groups() ->
{muc_light, [], muc_light_cases()},
{prefs_cases, [parallel], prefs_cases()},
{muc_prefs_cases, [parallel], muc_prefs_cases()},
{no_prefs_cases, [parallel], no_prefs_cases()},
{impl_specific, [], impl_specific()},
{disabled_text_search, [],
[{mam04, [], disabled_text_search_cases()}]},
Expand Down Expand Up @@ -509,6 +516,9 @@ muc_prefs_cases() ->
muc_messages_filtered_when_prefs_default_policy_is_never,
muc_messages_filtered_when_prefs_default_policy_is_roster].

no_prefs_cases() ->
[prefs_disabled_set_request].

impl_specific() ->
[check_user_exist,
pm_failed_to_decode_message_in_database,
Expand Down Expand Up @@ -762,6 +772,9 @@ mam_opts_for_conf(rdbms_easy) ->
EasyOpts = #{db_jid_format => mam_jid_rfc,
db_message_format => mam_message_xml},
maps:merge(EasyOpts, mam_opts_for_conf(rdbms));
mam_opts_for_conf(rdbms_no_prefs) ->
#{async_writer => #{enabled => false},
cache_users => false};
mam_opts_for_conf(rdbms) ->
#{user_prefs_store => rdbms,
async_writer => #{enabled => false},
Expand Down Expand Up @@ -3547,6 +3560,18 @@ prefs_set_request(Config) ->
end,
escalus:fresh_story(Config, [{alice, 1}], F).

prefs_disabled_set_request(Config) ->
F = fun(Alice) ->
escalus:send(Alice, stanza_prefs_set_request(<<"roster">>,
[<<"romeo@montague.net">>],
[<<"montague@montague.net">>],
mam_ns_binary())),
escalus:assert(is_error, [<<"cancel">>, <<"feature-not-implemented">>],
escalus:wait_for_stanza(Alice)),
assert_event_with_jid(mod_mam_pm_set_prefs, escalus_utils:get_short_jid(Alice))
end,
escalus:fresh_story(Config, [{alice, 1}], F).

query_get_request(Config) ->
F = fun(Alice) ->
QueryXmlns = mam_ns_binary_v04(),
Expand Down Expand Up @@ -3641,7 +3666,7 @@ muc_prefs_set_request_not_an_owner(ConfigIn) ->
[<<"montague@montague.net">>],
mam_ns_binary()), Room)),
escalus:assert(is_error, [<<"cancel">>, <<"not-allowed">>], escalus:wait_for_stanza(Bob)),
assert_no_event_with_jid(mod_mam_muc_get_prefs, RoomAddr)
assert_no_event_with_jid(mod_mam_muc_set_prefs, RoomAddr)
end,
RoomOpts = [{persistent, true}],
UserSpecs = [{alice, 1}, {bob, 1}],
Expand Down

0 comments on commit de22c49

Please sign in to comment.