Пример #1
0
    def test_csv_with_broken_file(self, mock_dataframe, mock_config_locations,
                                  mock_parse):
        self.tearDown()
        mock_config_locations.return_value = [self._path]
        mock_dataframe.side_effect = DataProviders.get_csv_results()
        with patch('pyccata.core.managers.clients.docx.Docx') as docx:
            docx.__implements__ = (ReportingInterface, )
            document = DocumentController('broken_csv.json')
            document.build()
            csvfiles = document._thread_manager.projectmanager._client._client
            self.assertIsInstance(csvfiles, CSVClient)
            self.assertEquals(len(csvfiles), 0)

            document.save('Test Document.docx')
Пример #2
0
    def test_csv_with_multi_file(self, mock_dataframe, mock_config_locations,
                                 mock_parse):
        mock_config_locations.return_value = [self._path]
        mock_dataframe.side_effect = DataProviders.get_csv_results()
        with patch('pyccata.core.managers.clients.docx.Docx') as docx:
            docx.__implements__ = (ReportingInterface, )
            document = DocumentController('csv_multi_file.json')
            document.build()
            self.assertEquals(
                None, document._thread_manager.projectmanager._client.server)
            self.assertIsInstance(
                document._thread_manager.projectmanager._client.projects(),
                list)
            csvfiles = document._thread_manager.projectmanager._client._client
            self.assertIsInstance(csvfiles, CSVClient)
            self.assertEquals(len(csvfiles), 2)
            for csv in csvfiles:
                self.assertIsInstance(csv._dataframe, pandas.DataFrame)
                self.assertEquals(len(csv._dataframe.index), 3)

            document.save('Test Document.docx')