Exemple #1
0
    def testProcess(self):
        """Tests the Process function on a Document Summary Information stream."""
        plugin = summary.DocumentSummaryInformationOLECFPlugin()
        storage_writer = self._ParseOLECFFileWithPlugin([u'Document.doc'],
                                                        plugin)

        # There should only be one summary info stream with one event.
        self.assertEqual(storage_writer.number_of_events, 1)

        events = list(storage_writer.GetSortedEvents())

        event = events[0]
        self.assertEqual(event.name, u'Document Summary Information')

        self.assertEqual(event.number_of_lines, 1)
        self.assertEqual(event.number_of_paragraphs, 1)
        self.assertEqual(event.company, u'KPMG')
        self.assertFalse(event.shared_document)
        self.assertEqual(event.application_version, u'14.0')

        # TODO: add support for:
        # self.assertEqual(event.is_shared, False)

        expected_message = (u'Number of lines: 1 '
                            u'Number of paragraphs: 1 '
                            u'Company: KPMG '
                            u'Shared document: False '
                            u'Application version: 14.0')

        expected_short_message = (u'Company: KPMG')

        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)
Exemple #2
0
    def testProcess(self):
        """Tests the Process function on a Document Summary Information stream."""
        plugin = summary.DocumentSummaryInformationOLECFPlugin()
        storage_writer = self._ParseOLECFFileWithPlugin(['Document.doc'],
                                                        plugin)

        self.assertEqual(storage_writer.number_of_warnings, 0)
        self.assertEqual(storage_writer.number_of_events, 1)

        events = list(storage_writer.GetSortedEvents())

        event = events[0]

        event_data = self._GetEventDataOfEvent(storage_writer, event)
        self.assertEqual(event_data.name, 'Document Summary Information')
        self.assertEqual(event_data.number_of_lines, 1)
        self.assertEqual(event_data.number_of_paragraphs, 1)
        self.assertEqual(event_data.company, 'KPMG')
        self.assertFalse(event_data.shared_document)
        self.assertEqual(event_data.application_version, '14.0')

        # TODO: add support for:
        # self.assertFalse(event_data.is_shared)

        expected_message = ('Number of lines: 1 '
                            'Number of paragraphs: 1 '
                            'Company: KPMG '
                            'Shared document: False '
                            'Application version: 14.0')

        expected_short_message = ('Company: KPMG')

        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)
Exemple #3
0
    def testProcess(self):
        """Tests the Process function on a Document Summary Information stream."""
        plugin = summary.DocumentSummaryInformationOLECFPlugin()
        storage_writer = self._ParseOLECFFileWithPlugin(['Document.doc'],
                                                        plugin)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 1)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)

        events = list(storage_writer.GetSortedEvents())

        expected_event_values = {
            'application_version': '14.0',
            'company': 'KPMG',
            'data_type': 'olecf:document_summary_info',
            'date_time': '2013-05-16 02:29:49.7950000',
            'name': 'Document Summary Information',
            'number_of_lines': 1,
            'number_of_paragraphs': 1,
            'shared_document': False
        }

        self.CheckEventValues(storage_writer, events[0], expected_event_values)
Exemple #4
0
  def testProcess(self):
    """Tests the Process function on a Document Summary Information stream."""
    plugin = summary.DocumentSummaryInformationOLECFPlugin()
    storage_writer = self._ParseOLECFFileWithPlugin(['Document.doc'], plugin)

    self.assertEqual(storage_writer.number_of_warnings, 0)
    self.assertEqual(storage_writer.number_of_events, 1)

    events = list(storage_writer.GetSortedEvents())

    expected_event_values = {
        'application_version': '14.0',
        'company': 'KPMG',
        'data_type': 'olecf:document_summary_info',
        'name': 'Document Summary Information',
        'number_of_lines': 1,
        'number_of_paragraphs': 1,
        'shared_document': False}

    self.CheckEventValues(storage_writer, events[0], expected_event_values)