import unittest import praw import random import requests import json import dotenv import discord from discord.ext import commands import General class TestGeneral(unittest.TestCase): def setUp(self): dotenv.load_dotenv() intents = discord.Intents.default() intents.message_content = True intents.members = True bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True, intents=intents) self.cog = General.General(bot) def test_playlist(self): data = self.cog.get_playlist_json() with self.subTest(msg="Reddit doesn't return 200"): self.assertEqual(data.status_code, 200) with self.subTest(msg="Not a good response"): self.assertIsInstance(data, requests.Response) with self.subTest(msg="Does not convert to json"): self.assertIsInstance(json.loads(data.content), dict)