def test_output_is_printed(self): # Must print when sys.exit effectively kills the program self.mock_sys_exit.side_effect = iter([SystemExit()]) try: print_and_exit(self.status, sentinel.additional) except SystemExit: pass self.mock_print_lines.assert_called_once_with( sentinel.whitespace_output)
def test_output_is_whitespaced(self): print_and_exit(self.status, sentinel.additional) self.mock_empty_to_whitespace.assert_called_once_with(sentinel.output)
def test_get_output_is_called(self): print_and_exit(self.status, sentinel.additional) self.mock_get_output.assert_called_once_with(self.status, sentinel.additional, None)
def test_message_is_proxied(self): print_and_exit(self.status, sentinel.additional, sentinel.message) self.mock_get_output.assert_called_once_with(self.status, sentinel.additional, sentinel.message)
def test_exit_is_called(self): print_and_exit(self.status, sentinel.additional) self.mock_sys_exit.assert_called_once_with(sentinel.exit_code)