Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test_game_handler_bot.py #642

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_quit_invite(self) -> None:
}
}
self.verify_response(
'quit', 'Game cancelled.\n!avatar([email protected]) **foo** quit.', 0, bot, 'foo')
'quit', 'Game cancelled.\n<i>avatar</i>([email protected]) **foo** quit.', 0, bot, 'foo')

def test_user_already_in_game_errors(self) -> None:
bot = self.setup_game()
Expand Down Expand Up @@ -313,14 +313,14 @@ def test_draw(self) -> None:

def test_normal_turns(self) -> None:
bot = self.setup_game()
self.verify_response('move 3', '**foo** moved in column 3\n\nfoo\n\n!avatar([email protected]) It\'s **baz**\'s (:red_circle:) turn.',
self.verify_response('move 3', '**foo** moved in column 3\n\nfoo\n\n<i>avatar</i>([email protected]) It\'s **baz**\'s (:red_circle:) turn.',
0, bot=bot, stream='test', subject='test game')
self.verify_response('move 3', '**baz** moved in column 3\n\nfoo\n\n!avatar([email protected]) It\'s **foo**\'s (:blue_circle:) turn.',
self.verify_response('move 3', '**baz** moved in column 3\n\nfoo\n\n<i>avatar</i>([email protected]) It\'s **foo**\'s (:blue_circle:) turn.',
0, bot=bot, stream='test', subject='test game', user_name='baz')

def test_wrong_turn(self) -> None:
bot = self.setup_game()
self.verify_response('move 5', '!avatar([email protected]) It\'s **foo**\'s (:blue_circle:) turn.', 0,
self.verify_response('move 5', '<i>avatar</i>([email protected]) It\'s **foo**\'s (:blue_circle:) turn.', 0,
bot=bot, stream='test', subject='test game', user_name='baz')

def test_private_message_error(self) -> None:
Expand Down Expand Up @@ -390,7 +390,7 @@ def test_game_over_and_leaderboard(self) -> None:
bot = self.setup_game()
bot.put_user_cache()
with patch('zulip_bots.bots.game_handler_bot.game_handler_bot.MockModel.determine_game_over', return_value='[email protected]'):
self.verify_response('move 3', '!avatar([email protected]) **foo** won! :tada:',
self.verify_response('move 3', '<i>avatar</i>([email protected]) **foo** won! :tada:',
1, bot=bot, stream='test', subject='test game')
leaderboard = '**Most wins**\n\n\
Player | Games Won | Games Drawn | Games Lost | Total Games\n\
Expand All @@ -403,12 +403,12 @@ def test_game_over_and_leaderboard(self) -> None:
def test_current_turn_winner(self) -> None:
bot = self.setup_game()
with patch('zulip_bots.bots.game_handler_bot.game_handler_bot.MockModel.determine_game_over', return_value='current turn'):
self.verify_response('move 3', '!avatar([email protected]) **foo** won! :tada:',
self.verify_response('move 3', '<i>avatar</i>([email protected]) **foo** won! :tada:',
1, bot=bot, stream='test', subject='test game')

def test_computer_turn(self) -> None:
bot = self.setup_computer_game()
self.verify_response('move 3', '**foo** moved in column 3\n\nfoo\n\n!avatar([email protected]) It\'s **test-bot**\'s (:red_circle:) turn.',
self.verify_response('move 3', '**foo** moved in column 3\n\nfoo\n\n<i>avatar</i>([email protected]) It\'s **test-bot**\'s (:red_circle:) turn.',
0, bot=bot, stream='test', subject='test game')
with patch('zulip_bots.bots.game_handler_bot.game_handler_bot.MockModel.determine_game_over', return_value='[email protected]'):
self.verify_response('move 5', 'I won! Well Played!',
Expand Down Expand Up @@ -462,7 +462,7 @@ def test_get_game_info(self) -> None:
def test_parse_message(self) -> None:
bot = self.setup_game()
self.verify_response('move 3', 'Join your game using the link below!\n\n> **Game `abc123`**\n\
> !avatar([email protected])\n\
> <i>avatar</i>([email protected])\n\
> foo test game\n\
> 2/2 players\n\
> **[Join Game](/#narrow/stream/test/topic/test game)**', 0, bot=bot)
Expand All @@ -471,7 +471,7 @@ def test_parse_message(self) -> None:
To move subjects, send your message again, otherwise join the game using the link below.

> **Game `abc123`**
> !avatar([email protected])
> <i>avatar</i>([email protected])
> foo test game
> 2/2 players
> **[Join Game](/#narrow/stream/test/topic/test game)**''', 0, bot=bot, stream='test 2', subject='game 2')
Expand All @@ -485,7 +485,7 @@ def test_change_game_subject(self) -> None:
To move subjects, send your message again, otherwise join the game using the link below.

> **Game `abcdefg`**
> !avatar([email protected])
> <i>avatar</i>([email protected])
> foo test game
> 2/2 players
> **[Join Game](/#narrow/stream/test2/topic/test game 2)**''', 0, bot=bot, user_name='bar', stream='test game', subject='test2')
Expand Down