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)
Esempio n. 3
0
async def run():
    """
    Bot setup
    """
    async with aiohttp.ClientSession() as session:
        bot.add_cog(DevCommands(bot))
        bot.add_cog(GeneralCommands(bot, session))
        bot.add_cog(LinksCommands(bot))
        if os.getenv("DBL_TOKEN"):
            bot.add_cog(TopGG(bot, os.getenv("DBL_TOKEN")))
        logs.webhook_url = os.getenv("WEBHOOK_URL")  # None if not set
        logs.error_supervisor = os.getenv("WEBHOOK_ERROR_SUPERVISOR_ID")
        await bot.start(os.environ["BOT_TOKEN"])
async def run():
    """
    Bot setup
    """
    async with aiohttp.ClientSession() as session:
        token = env_file.get()
        bot.add_cog(DevCommands(bot))
        bot.add_cog(GeneralCommands(bot, session))
        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']
        await bot.start(token['BOT_TOKEN'])
Esempio n. 5
0
 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)
Esempio n. 6
0
 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], [])
Esempio n. 7
0
 async def test_that_raises_lyrics_not_found(self):
     with self.assertRaises(LyricsNotFound):
         asyncio.create_task(GeneralCommands.get_lyrics("(*&d78a kj"))
Esempio n. 8
0
 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)
Esempio n. 9
0
 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)