def test_should_send_answer_without_writing_to_stdout_and_stderr(self, mock_exit, mock_stderr, mock_stdout): answer = Answer(None, None, 123) commandstub.send_answer(answer) self.assertEqual('', mock_stdout.getvalue()) self.assertEqual('', mock_stderr.getvalue()) self.assertEqual(call(123), mock_exit.call_args)
def test_should_send_answer(self, mock_exit, mock_stderr, mock_stdout): answer = Answer('Hello world!', 'Hello error!', 223) commandstub.send_answer(answer) self.assertEqual('Hello world!', mock_stdout.getvalue()) self.assertEqual('Hello error!', mock_stderr.getvalue()) self.assertEqual(call(223), mock_exit.call_args)