Пример #1
0
 async def test_broadcaster_limit(self):
     self.permissions.broadcaster = True
     self.assertIs(await wall.process_wall(self.args, 'Kappa ', 1000), True)
     self.channel.send.assert_called_once_with(
         IterableMatch(*([StrContains()] * (500))), -1)
     self.assertFalse(self.mock_cooldown.called)
     self.assertFalse(self.mock_timeout.called)
Пример #2
0
 async def test_1(self):
     self.permissions.broadcaster = True
     self.permissions.globalModerator = True
     self.assertIs(await wall.process_wall(self.args, 'Kappa', 1), True)
     self.channel.send.assert_called_once_with(IterableMatch('Kappa'), -1)
     self.assertFalse(self.mock_cooldown.called)
     self.assertFalse(self.mock_timeout.called)
Пример #3
0
 async def test_moderator_limit(self):
     self.mock_cooldown.return_value = False
     self.assertIs(await wall.process_wall(self.args, 'Kappa', 100), True)
     self.channel.send.assert_called_once_with(
         IterableMatch(*([StrContains()] * (10))), -1)
     self.assertFalse(self.mock_timeout.called)
     self.mock_cooldown.assert_called_once_with(self.args,
                                                timedelta(seconds=30),
                                                'modWall')
Пример #4
0
 async def test_1(self):
     self.permissionSet['broadcaster'] = True
     self.permissions.broadcaster = True
     self.permissions.globalModerator = True
     message = Message('!rpyramid 1')
     args = self.args._replace(message=message)
     self.assertIs(await pyramid.commandRandomPyramid(args), True)
     self.channel.send.assert_called_once_with(IterableMatch(':)'), -1)
     self.assertFalse(self.mock_cooldown.called)
Пример #5
0
 async def test_limit(self):
     self.mock_config.messageLimit = 10
     self.permissions.broadcaster = True
     self.permissions.globalModerator = True
     self.assertIs(await pyramid.process_pyramid(self.args, 'Kappa', 2),
                   True)
     self.channel.send.assert_called_once_with(IterableMatch('Kappa'), -1)
     self.assertFalse(self.mock_cooldown.called)
     self.assertFalse(self.mock_timeout.called)
Пример #6
0
 async def test_broadcaster_limit(self):
     self.mock_config.messageLimit = 10000
     self.permissions.broadcaster = True
     self.assertIs(await pyramid.process_pyramid(self.args, 'Kappa ', 100),
                   True)
     self.channel.send.assert_called_once_with(
         IterableMatch(*([StrContains()] * (20 + 20 - 1))), -1)
     self.assertFalse(self.mock_cooldown.called)
     self.assertFalse(self.mock_timeout.called)
Пример #7
0
 async def test_moderator(self):
     self.permissionSet['moderator'] = True
     self.features.append('modpyramid')
     message = Message('!rpyramid')
     args = self.args._replace(message=message)
     self.assertIs(await pyramid.commandRandomPyramid(args), True)
     self.channel.send.assert_called_once_with(
         IterableMatch(':)', ':) FrankerZ', ':) FrankerZ PogChamp',
                       ':) FrankerZ', ':)'), -1)
     self.mock_cooldown.assert_called_once_with(args, timedelta(seconds=30),
                                                'modPyramid')
Пример #8
0
 async def test_broadcaster_limit(self):
     self.mock_choice.side_effect = [0, 5, 3, 1, 7] * 10
     self.mock_config.messageLimit = 1000
     self.permissionSet['broadcaster'] = True
     self.permissions.broadcaster = True
     message = Message('!rpyramid 50')
     args = self.args._replace(message=message)
     self.assertIs(await pyramid.commandRandomPyramid(args), True)
     self.channel.send.assert_called_once_with(
         IterableMatch(*([StrContains()] * (20 + 20 - 1))), -1)
     self.assertFalse(self.mock_cooldown.called)
Пример #9
0
 async def test_moderator_limit(self):
     self.mock_config.messageLimit = 100
     self.mock_cooldown.return_value = False
     self.assertIs(await pyramid.process_pyramid(self.args, 'Kappa', 2),
                   True)
     self.channel.send.assert_called_once_with(
         IterableMatch('Kappa', 'Kappa Kappa', 'Kappa'), -1)
     self.assertFalse(self.mock_timeout.called)
     self.mock_cooldown.assert_called_once_with(self.args,
                                                timedelta(seconds=30),
                                                'modPyramid')
Пример #10
0
 async def test_channel_mod(self):
     self.permissions.broadcaster = True
     self.permissions.globalModerator = True
     self.permissions.chatModerator = True
     self.assertIs(await wall.process_wall(self.args, 'Kappa', 2), True)
     self.channel.send.assert_called_once_with(
         IterableMatch('Kappa', 'Kappa'), -1)
     self.assertFalse(self.mock_cooldown.called)
     self.mock_timeout.assert_called_once_with(self.channel, 'botgotsthis',
                                               'Kappa',
                                               str(self.args.message),
                                               'wall')
Пример #11
0
 async def test_raw_command(self, mock_whisper, mock_config):
     mock_config.messageLimit = 100
     input = CommandActionTokens('', self.broadcaster, '',
                                 'Kappa', 'PogChamp')
     self.data.getCustomCommand.return_value = 'KappaRoss KappaPride'
     self.assertIs(await channel.raw_command(self.args, input), True)
     self.data.getCustomCommand.assert_called_once_with(
         self.broadcaster, '', 'Kappa')
     mock_whisper.assert_called_once_with(
         'botgotsthis',
         IterableMatch('KappaRoss KappaPride'))
     self.assertFalse(self.channel.send.called)