def test_export_to_html(self, mock_writer, mock_os, _):
        mock_writer.write_temp_file.return_value = self.path
        mock_os.path.basename.return_value = 'test'
        mock_os.path.splitext.return_value = ['base1', 'base2']
        mock_os.path.join.return_value = '/this/is/the/joined/path.html'

        Export.export_html(self.document)

        mock_writer.write_temp_file.assert_called_once_with(self.document)
        mock_writer.write_exported_html_file.assert_called_once_with(
            ['markdown', self.path], '/this/is/the/joined/path.html')
        mock_os.path.basename.assert_called_once_with(self.path)
        mock_os.path.join.assert_called_once_with('/some/path', 'base1.html')
Esempio n. 2
0
    def _export_to_html(self, action):
        """
        Menu activation handler for HTMl export.

        Calls the `Export` module from `export.py` to handle the actual file manipulation.
        """
        del action

        doc = self.window.get_active_document()
        if not doc:
            print('[Export to HTML] No document.')
            return

        Export.export_html(doc)