Skip to content

Commit

Permalink
Test kicking user from non-existing room and fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Premwoik committed Apr 23, 2022
1 parent c8d6007 commit 8f88a85
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions big_tests/tests/graphql_muc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ user_muc_handler() ->
user_try_get_nonexistent_room_config,
user_invite_user,
user_kick_user,
user_try_kick_user_from_nonexistent_room,
user_try_kick_user_without_moderator_resource,
user_send_message_to_room,
user_send_message_to_room_with_specified_res,
Expand Down Expand Up @@ -78,6 +79,7 @@ admin_muc_handler() ->
admin_invite_user_with_password,
admin_try_invite_user_to_nonexistent_room,
admin_kick_user,
admin_try_kick_user_from_nonexistent_room,
admin_try_kick_user_in_room_without_moderators,
admin_send_message_to_room,
admin_send_private_message,
Expand Down Expand Up @@ -281,6 +283,10 @@ admin_try_kick_user_in_room_without_moderators(Config, _Alice, Bob) ->
Res = execute_auth(kick_user_body(RoomJID, BobNick, null), Config),
?assertNotEqual(nomatch, binary:match(get_err_msg(Res), <<"not found">>)).

admin_try_kick_user_from_nonexistent_room(Config) ->
Res = execute_auth(kick_user_body(?NONEXISTENT_ROOM, <<"ali">>, null), Config),
?assertNotEqual(nomatch, binary:match(get_err_msg(Res), <<"not found">>)).

admin_send_message_to_room(Config) ->
muc_helper:story_with_room(Config, [], [{alice, 1}, {bob, 1}],
fun admin_send_message_to_room_story/3).
Expand Down Expand Up @@ -454,7 +460,8 @@ admin_set_user_role(Config, Alice, Bob) ->
assert_user_role(RoomJID, Bob, moderator).

admin_try_set_user_role_in_room_without_moderators(Config) ->
muc_helper:story_with_room(Config, [], [{alice, 1}, {bob, 1}], fun admin_try_set_user_role_in_room_without_moderators/3).
muc_helper:story_with_room(Config, [], [{alice, 1}, {bob, 1}],
fun admin_try_set_user_role_in_room_without_moderators/3).

admin_try_set_user_role_in_room_without_moderators(Config, _Alice, Bob) ->
RoomJID = jid:from_binary(?config(room_jid, Config)),
Expand Down Expand Up @@ -663,7 +670,8 @@ user_kick_user_story(Config, Alice, Bob) ->
{element, <<"reason">>}, cdata])).

user_try_kick_user_without_moderator_resource(Config) ->
muc_helper:story_with_room(Config, [], [{alice, 1}, {bob, 1}], fun user_try_kick_user_without_moderator_resource/3).
muc_helper:story_with_room(Config, [], [{alice, 1}, {bob, 1}],
fun user_try_kick_user_without_moderator_resource/3).

user_try_kick_user_without_moderator_resource(Config, Alice, Bob) ->
RoomJIDBin = ?config(room_jid, Config),
Expand All @@ -673,6 +681,14 @@ user_try_kick_user_without_moderator_resource(Config, Alice, Bob) ->
Res = execute_user(kick_user_body(RoomJID, BobNick, null), Alice, Config),
?assertNotEqual(nomatch, binary:match(get_err_msg(Res), <<"not found">>)).

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

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

user_send_message_to_room(Config) ->
muc_helper:story_with_room(Config, [], [{alice, 1}, {bob, 1}],
fun user_send_message_to_room_story/3).
Expand Down

0 comments on commit 8f88a85

Please sign in to comment.