def test_convert_file_success(self, mock_open_, mock_print, mock_markdown): filename = 'foo' cli.convert_file(filename, sentinel.RendererCls) mock_open_.assert_called_with(filename, 'r') mock_print.assert_called_with('rendered text', end='')
def test_convert_file_fail(self, mock_exit, mock_open_): filename = 'foo' cli.convert_file(filename, sentinel.RendererCls) mock_open_.assert_called_with(filename, 'r') mock_exit.assert_called_with('Cannot open file "foo".')
def test_convert_file_success(self, mock_open_, mock_write, mock_markdown): filename = 'foo' cli.convert_file(filename, sentinel.RendererCls) mock_open_.assert_called_with(filename, 'r', encoding='utf-8') mock_write.assert_called_with('rendered text'.encode())