def test040_delete(self): command = Command(10000, 'brexbottest', 'test', 'test command', 1, 'It is a test command', 1, 1, 1, 1, 1, 1).load() self.assertIsNotNone(command) command.delete() exist_check = command.exists() self.assertEqual(exist_check, None)
def test010_save(self): self.assertEqual( Command(10000, 'brexbottest', 'test', 'test command', 1, 'It is a test command', 1, 1, 1, 1, 1, 1).exists(), None) Command(10000, 'brexbottest', 'test', 'test command', 1, 'It is a test command', 1, 1, 1, 1, 1, 1).save() self.assertEqual( Command(10000, 'brexbottest', 'test', 'test command', 1, 'It is a test command', 1, 1, 1, 1, 1, 1).exists(), True)
def test_command_does_not_exists_is_not_triggered(self): command = "!boguscommand" message = Message(command, "randomuser") channel = Channel(Config.CHANNEL_NAME) channel.commands.append( Command(-1, Config.CHANNEL_NAME, "Blizzard id", True, "My Blizzard ID is UncleBob#199", True, True, True, False, False, False, None, None)) commandhandler = CommandHandler(channel) commandres, can_trigger = commandhandler.is_command_triggered(message) self.assertEqual(None, commandres) self.assertEqual(None, can_trigger)
def test_command_exists_and_is_triggered(self): command = "!social" commandname = "social" message = Message(command, "randomuser") channel = Channel(Config.CHANNEL_NAME) channel.commands.append( Command(-1, Config.CHANNEL_NAME, "social", True, "Join my Discord at www.discord.com", True, True, True, True, True, True, None, None)) commandhandler = CommandHandler(channel) commandres, can_trigger = commandhandler.is_command_triggered(message) self.assertEqual(commandname, commandres.name) self.assertEqual(True, can_trigger)
def test030_load(self): command = Command(10000, 'brexbottest', 'test', 'test command', 1, 'It is a test command', 1, 1, 1, 1, 1, 1).load() self.assertIsNotNone(command)
def test020_exists(self): command = Command(10000, 'brexbottest', 'test', 'test command', 1, 'It is a test command', 1, 1, 1, 1, 1, 1).load() exist_check = command.exists() self.assertEqual(exist_check, True)