Exemple #1
0
 def test_add_paragraph(self, mock_document, mock_load, mock_locations):
     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_locations.return_value = [self._path]
             mock_config.return_value = DataProviders._get_config_for_test()
             mock_reporting.return_value = 'docx'
             r = ReportManager()
             r.add_paragraph('hello world')
             mock_document.assert_called_with('hello world', style=None)
Exemple #2
0
 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')
Exemple #3
0
 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)