def test_that_artists_list_converts_to_string(self): self.assertEqual("Eminem", GeneralCommands.artists_to_string(["Eminem"])) self.assertEqual( "Eminem, 50 Cent", GeneralCommands.artists_to_string(["Eminem", "50 Cent"])) self.assertEqual("", GeneralCommands.artists_to_string(""))
def test_that_pack_into_messages_packs_into_two(self): chunks = [ self.testing_lyrics, self.testing_lyrics, self.testing_lyrics, self.testing_lyrics_2, self.testing_lyrics_2 ] messages = GeneralCommands.pack_into_messages(chunks) self.assertEqual(len(messages), 2)
def run(): """ Bot setup """ token = env_file.get() bot.add_cog(DevCommands(bot)) bot.add_cog(GeneralCommands(bot)) bot.add_cog(LinksCommands(bot)) if 'DBL_TOKEN' in token: bot.add_cog(TopGG(bot, token['DBL_TOKEN'])) if 'WEBHOOK_URL' in token: logs.webhook_url = token['WEBHOOK_URL'] if 'WEBHOOK_ERROR_SUPERVISOR_ID' in token: logs.error_supervisor = token['WEBHOOK_ERROR_SUPERVISOR_ID'] bot.run(token["BOT_TOKEN"])
def test_that_pack_into_messages_packs_into_one(self): chunks = ["I am mr. robot", "or am I?", "hey vsauce, michael here"] messages = GeneralCommands.pack_into_messages(chunks) self.assertEqual(len(messages), 1)
def test_that_pack_into_messages_returns_empty_message(self): chunks = [] messages = GeneralCommands.pack_into_messages(chunks) self.assertEqual(len(messages), 1) self.assertEqual(messages[0], [])
async def test_that_raises_lyrics_not_found(self): with self.assertRaises(LyricsNotFound): asyncio.create_task(GeneralCommands.get_lyrics("(*&d78a kj"))
async def test_01that_lyrics_is_correct(self): lyrics = GeneralCommands.get_lyrics("Wonderful", "Caravan Palace") self.assertEqual(lyrics, self.testing_lyrics)
def test_that_chopped_lyrics_with_long_chunk_does_not_exceed_1024_chars( self): chunks = GeneralCommands.chop_string_into_chunks( self.testing_lyrics_2, 1024) for chunk in chunks: self.assertTrue(len(chunk) <= 1024)
def test_that_lyrics_chunks_does_not_exceed_1024_chars(self): chunks = GeneralCommands.chop_string_into_chunks( self.testing_lyrics, 1024) for chunk in chunks: print(len(chunk)) self.assertTrue(len(chunk) <= 1024)