def test_run_command_with_first_and_lastname(self): mtype, resp = chuck.run_command(None, 'firstname', 'lastname') self.assertEqual(mtype, 'groupchat') self.assertEqual(resp, '>the joke<') self.mock_request.assert_called_once_with( 'http://api.icndb.com/jokes/random', params={'firstName': 'firstname', 'lastName': 'lastname'})
def test_run_command_without_args(self): mtype, resp = chuck.run_command(None) self.assertEqual(mtype, 'groupchat') self.assertEqual(resp, '>the joke<') self.mock_request.assert_called_once_with( 'http://api.icndb.com/jokes/random', params=None)
def test_run_command_with_to_many_args(self): mtype, resp = chuck.run_command(None, 'firstname', 'lastname', 'other') self.assertEqual(mtype, 'groupchat') self.assertEqual(resp, 'You must append a firstname *and* a lastname') self.assertFalse(self.mock_request.called)