Files
Gwendolyn/gwendolynTest.py
NikolajDanger 1e2f64c67c Trivia command
2020-04-05 18:37:59 +02:00

51 lines
2.2 KiB
Python

import unittest
import funcs
class testSwChar(unittest.TestCase):
def test1NewChar(self):
text1, result = funcs.parseChar("TestUser","")
self.assertEqual(result,"Character for TestUser created")
def testChangeName(self):
text1, result = funcs.parseChar("TestUser","name TestChar")
self.assertEqual(result,"Changed TestChar's Name to TestChar")
def testChangeChar(self):
text1, result = funcs.parseChar("TestUser","characteristics brawn 1")
self.assertEqual(result,"Changed New Character's Characteristics")
def testXChar(self):
text1, result = funcs.parseChar("TestUser","Purge")
self.assertEqual(result,"Character for TestUser deleted")
class testGwendolynFuncs(unittest.TestCase):
def testCap(self):
self.assertEqual(funcs.cap("planet of the apes"),"Planet of the Apes")
self.assertEqual(funcs.cap("the greatest showman"),"The Greatest Showman")
self.assertEqual(funcs.cap("i'm the best person!"),"I'm the Best Person!")
def testWikiExists(self):
title, content, thumbnail = funcs.findWikiPage("Vivo")
self.assertEqual(title,"Vivo (Gud)")
self.assertEqual(content,"Vivo er den Phenolske gud for liv. Hun er en af de tre store guder der kom af at Unua splittede sig i 3.")
def testWikiDoesntExist(self):
title, content, thumbnail = funcs.findWikiPage("Big Butts")
self.assertEqual(title,"")
self.assertEqual(content,"Couldn't find page")
def testWikiImage(self):
title, content, thumbnail = funcs.findWikiPage("Moldaw")
self.assertEqual(title,"Moldaw Dragniel")
self.assertEqual(content,"Moldaw Dragniel (Født: Moldaw Geisler Dragniel) er en Rock Gnome fra den sydvestlige del af Zules Kongeriget i kejserriget Crozea. Han kommer fra den store landsby Ginti, hvor hans forældre arbejdede som håndværkere.")
self.assertEqual(thumbnail,"https://vignette.wikia.nocookie.net/senkulpa/images/9/9e/Moldaw.png/revision/latest?path-prefix=da")
def testTriviaStart(self):
info = funcs.triviaStart()
print(info)
self.assertNotEqual(info,"")
if __name__ == "__main__":
unittest.main()