Skip to content

Commit

Permalink
Add missing non-existent room test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Premwoik committed Apr 12, 2022
1 parent 3c2357d commit 8427ad6
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion big_tests/tests/graphql_muc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ user_muc_handler() ->
user_owner_set_user_affiliation,
user_admin_set_user_affiliation,
user_member_set_user_affiliation,
user_try_set_nonexistent_room_affiliation,
user_moderator_set_user_role,
user_participant_set_user_role,
user_try_set_nonexistent_room_role,
user_can_enter_room,
user_can_enter_room_with_password,
user_can_exit_room,
user_list_room_affiliation,
user_try_list_room_affiliation_without_permission
user_try_list_room_affiliation_without_permission,
user_try_list_nonexistent_room_affiliations
].

admin_muc_handler() ->
Expand Down Expand Up @@ -895,6 +898,14 @@ user_member_set_user_affiliation(Config, Alice, Bob, Kate) ->
Res3 = execute_user(set_user_affiliation_body(RoomJID, Kate, none), Bob, Config),
assert_no_permission(Res3).

user_try_set_nonexistent_room_affiliation(Config) ->
escalus:fresh_story_with_config(Config, [{alice, 1}],
fun user_try_set_nonexistent_room_affiliation/2).

user_try_set_nonexistent_room_affiliation(Config, Alice) ->
Res = execute_user(set_user_affiliation_body(?NONEXISTENT_ROOM, Alice, none), Alice, Config),
?assertNotEqual(nomatch, binary:match(get_err_msg(Res), <<"not found">>)).

user_moderator_set_user_role(Config) ->
muc_helper:story_with_room(Config, [{anonymous, false}, {persistent, true}],
[{alice, 1}, {bob, 1}],
Expand Down Expand Up @@ -940,6 +951,14 @@ user_participant_set_user_role(Config, _Alice, Bob, Kate) ->
Res2 = execute_user(set_user_role_body(RoomJID, KateNick, moderator), Bob, Config),
assert_no_permission(Res2).

user_try_set_nonexistent_room_role(Config) ->
escalus:fresh_story_with_config(Config, [{alice, 1}],
fun user_try_set_nonexistent_room_role/2).

user_try_set_nonexistent_room_role(Config, Alice) ->
Res = execute_user(set_user_role_body(?NONEXISTENT_ROOM, <<"Ali">>, participant), Alice, Config),
?assertNotEqual(nomatch, binary:match(get_err_msg(Res), <<"not found">>)).

user_can_enter_room(Config) ->
muc_helper:story_with_room(Config, [], [{alice, 1}], fun user_can_enter_room/2).

Expand Down Expand Up @@ -1023,6 +1042,14 @@ user_try_list_room_users_without_permission(Config, _Alice, Bob) ->
Res = execute_user(list_room_affiliations_body(RoomJID, null), Bob, Config),
assert_no_permission(Res).

user_try_list_nonexistent_room_affiliations(Config) ->
escalus:fresh_story_with_config(Config, [{alice, 1}],
fun user_try_list_nonexistent_room_affiliations/2).

user_try_list_nonexistent_room_affiliations(Config, Alice) ->
Res = execute_user(list_room_affiliations_body(?NONEXISTENT_ROOM, null), Alice, Config),
?assertNotEqual(nomatch, binary:match(get_err_msg(Res), <<"not found">>)).

%% Helpers

assert_no_permission(Res) ->
Expand Down

0 comments on commit 8427ad6

Please sign in to comment.