Exemplo n.º 1
0
 def test_player_count_display_with_players(self):
     bot = GatherBot('testuser')
     bot.organiser.queues['testchannel'] = set(['player1', 'player2'])
     self.assertEqual(
         '(2/10)',
         bot.player_count_display('testchannel')
     )
Exemplo n.º 2
0
 def test_player_count_display_with_zero(self):
     bot = GatherBot('testuser')
     bot.organiser.queues['testchannel'] = set()
     self.assertEqual(
         '(0/10)',
         bot.player_count_display('testchannel')
     )
Exemplo n.º 3
0
    async def test_announce_players(self, mock_organiser):
        bot = GatherBot('testuser')
        bot.say = get_mock_coro(True)
        bot.player_count_display = unittest.mock.Mock(return_value='(1/10)')
        bot.organiser.queues['test channel'] = set(['mac'])

        await bot.announce_players('test channel')

        bot.say.assert_called_with(
            'test channel',
            'Currently signed in players (1/10): mac'
        )
Exemplo n.º 4
0
    async def test_member_went_afk_in_channels(self):
        bot = GatherBot('testuser')
        bot.say = get_mock_coro(True)
        bot.announce_players = get_mock_coro(True)
        bot.player_count_display = get_mock_coro(True)
        bot.organiser = unittest.mock.Mock()
        bot.organiser.remove_from_all.return_value = set(['testchannel'])
        player = unittest.mock.Mock()

        await bot.member_went_afk(player)

        self.assertTrue(bot.organiser.remove_from_all.called)
        self.assertTrue(bot.say.called)
        self.assertTrue(bot.announce_players.called)