Voegt test voor review toe

This commit is contained in:
2022-12-04 20:40:30 +01:00
parent 47ae62afa9
commit e8df92be23
3 changed files with 38 additions and 8 deletions
+1
View File
@@ -1 +1,2 @@
from .shitpost import TestShitpost
from .general import TestGeneral
+27
View File
@@ -0,0 +1,27 @@
import unittest
import dotenv
import discord
from discord.ext import commands
import Shitpost
class TestShitpost(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 = Shitpost.Shitpost(bot)
def test_review(self):
TOPIC = "qpwoeirut12"
topic_review = self.cog.get_review_string(TOPIC)
with self.subTest(msg=f"Topic review does not return a string"):
self.assertIsInstance(topic_review, str)
with self.subTest(msg=f"Topic review does not contain the topic"):
self.assertIn(TOPIC, topic_review)
basic_review = self.cog.get_review_string()
with self.subTest(msg=f"Review does not return a string"):
self.assertIsInstance(basic_review, str)