Beispiel #1
0
 def test_handle_getquote(self):
     expected_response = "quote retrieved"
     quotebot.retrieve_random_quote = MagicMock(
         return_value=expected_response)
     fake_command = "!quote"
     received_response = listener.handle_command(fake_command)
     self.assertEqual(expected_response, received_response)
Beispiel #2
0
 def test_handle_addquote(self):
     expected_response = "quote added"
     quotebot.add_quote = MagicMock(return_value=expected_response)
     fake_command = "!addquote add this quote"
     received_response = listener.handle_command(fake_command)
     self.assertEqual(expected_response, received_response)
Beispiel #3
0
 def test_handle_bad_command(self):
     expected_response = "Command !iwontwork not found"
     fake_command = "!iwontwork"
     received_response = listener.handle_command(fake_command)
     self.assertEqual(expected_response, received_response)
Beispiel #4
0
 def test_handle_getquote_fails(self):
     expected_response = "I don't understand that stuff after '!quote'"
     fake_command = "!quote blahblah"
     received_response = listener.handle_command(fake_command)
     self.assertEqual(expected_response, received_response)
Beispiel #5
0
 def test_handle_deletequote_fails_non_integer(self):
     expected_response = "gimme an actual quote number to delete"
     fake_command = "!deletequote 12.1"
     received_response = listener.handle_command(fake_command)
     self.assertEqual(expected_response, received_response)
Beispiel #6
0
 def test_handle_deletequote_fails(self):
     expected_response = "gimme a quote number to delete"
     fake_command = "!deletequote"
     received_response = listener.handle_command(fake_command)
     self.assertEqual(expected_response, received_response)
Beispiel #7
0
 def test_handle_deletequote(self):
     expected_response = "quote deleted"
     quotebot.remove_quote = MagicMock(return_value=expected_response)
     fake_command = "!deletequote 12"
     received_response = listener.handle_command(fake_command)
     self.assertEqual(expected_response, received_response)