def test_add_run_with_no_style(self, mock_run, mock_load): with patch('pyccata.core.configuration.Configuration.reporting', new_callable=PropertyMock) as mock_reporting: with patch( 'pyccata.core.configuration.Configuration._configuration', new_callable=PropertyMock) as mock_config: mock_config.return_value = DataProviders._get_config_for_test() mock_reporting.return_value = 'docx' r = ReportManager() r.add_paragraph('hello world') r.add_run('This is a paragraph run') mock_run.assert_called_with('This is a paragraph run')
def test_format_for_email(self, mock_run, mock_load): with patch('pyccata.core.configuration.Configuration.reporting', new_callable=PropertyMock) as mock_reporting: with patch( 'pyccata.core.configuration.Configuration._configuration', new_callable=PropertyMock) as mock_config: mock_config.return_value = DataProviders._get_config_for_test_no_template( ) mock_reporting.return_value = 'docx' r = ReportManager() r.add_paragraph('hello world') r.add_run('This is a paragraph run', style='bold') mock_run.assert_called_with('This is a paragraph run') self.assertTrue(mock_run.bold) r.format_for_email() self.assertIsInstance(r._client._client._body._body[0], CT_Tbl) self.assertIsInstance(r._client._client._body._body[1], CT_SectPr)