Example #1
0
 def test_createQuestions(self):
     wb = weightbot.WeightBot("test")
     self.assertEqual(weightbot.State.creating, wb.state)
     resp = wb.handleInput("What is love?")
     self.assertEqual(1, len(wb.questions))
     self.assertEqual(0, len(wb.answers))
     self.assertEqual(resp, weightbot.createResponse)
Example #2
0
 def test_handleWrongAnswersRating(self):
     wb = weightbot.WeightBot("test")
     wb.handleInput("What is love?")
     wb.handleInput("lets vote")
     resp = wb.handleInput("84 why not")
     self.assertEqual(0, len(wb.answers))
     self.assertTrue(resp)
Example #3
0
 def test_handleAnswersRating(self):
     wb = weightbot.WeightBot("test")
     wb.handleInput("What is love?")
     wb.handleInput("lets vote")
     resp = wb.handleInput("4 why not")
     self.assertEqual(1, len(wb.answers))
     self.assertEqual((4, "why not"), wb.answers[0])
     self.assertTrue(resp)
Example #4
0
 def test_handleAnswers(self):
     wb = weightbot.WeightBot("test")
     wb.handleInput("What is love?")
     wb.handleInput("lets vote")
     resp = wb.handleInput("1 Baby dont hurt me")
     self.assertEqual(1, len(wb.answers))
     self.assertEqual((1, "Baby dont hurt me"), wb.answers[0])
     self.assertTrue(resp)
Example #5
0
 def test_changeMode(self):
     wb = weightbot.WeightBot("test")
     wb.handleInput("What is love?")
     resp = wb.handleInput("lets vote")
     self.assertEqual(weightbot.State.asking, wb.state)
     self.assertTrue(weightbot.startVoteRepsonse in resp)
     self.assertTrue("Question 1:" in resp)
     self.assertTrue("What is love?" in resp)
Example #6
0
 def test_begin(self):
     wb = weightbot.WeightBot("test")
     self.assertTrue(isinstance(wb.questions, list))
     self.assertTrue(isinstance(wb.answers, list))
     self.assertEqual(weightbot.State.creating, wb.state)
Example #7
0
 def test_changeModeDeniedWihtoutQuestions(self):
     wb = weightbot.WeightBot("test")
     resp = wb.handleInput("lets vote")
     self.assertEqual(weightbot.State.creating, wb.state)
     self.assertTrue(weightbot.noQuestions in resp)
Example #8
0
 def test_velcome(self):
     wb = weightbot.WeightBot("test")
     self.assertTrue(isinstance(wb.welcome(), str))
Example #9
0
 def test_nameStrip(self):
     wb = weightbot.WeightBot("    test     ")
     self.assertEqual("test", wb.name)