def testRead(self): """Tests the Read function.""" test_file = self._GetTestFilePath([u"psort_test.proto.plaso"]) zip_file_object = zipfile.ZipFile(test_file, "r", zipfile.ZIP_DEFLATED, allowZip64=True) stream_name = u"plaso_timestamps.000003" offset_table = zip_file._SerializedDataTimestampTable(zip_file_object, stream_name) offset_table.Read() stream_name = u"bogus" offset_table = zip_file._SerializedDataTimestampTable(zip_file_object, stream_name) with self.assertRaises(IOError): offset_table.Read()
def testRead(self): """Tests the Read function.""" test_file = self._GetTestFilePath([u'psort_test.json.plaso']) zip_file_object = zipfile.ZipFile( test_file, 'r', zipfile.ZIP_DEFLATED, allowZip64=True) stream_name = u'plaso_timestamps.000002' offset_table = zip_file._SerializedDataTimestampTable( zip_file_object, stream_name) offset_table.Read() stream_name = u'bogus' offset_table = zip_file._SerializedDataTimestampTable( zip_file_object, stream_name) with self.assertRaises(IOError): offset_table.Read()
def testRead(self): """Tests the Read function.""" test_file = self._GetTestFilePath([u'psort_test.json.plaso']) zip_file_object = zipfile.ZipFile( test_file, 'r', zipfile.ZIP_DEFLATED, allowZip64=True) stream_name = u'event_timestamps.000002' offset_table = zip_file._SerializedDataTimestampTable( zip_file_object, stream_name) offset_table.Read() stream_name = u'bogus' offset_table = zip_file._SerializedDataTimestampTable( zip_file_object, stream_name) with self.assertRaises(IOError): offset_table.Read()
def testGetTimestamp(self): """Tests the GetTimestamp function.""" test_file = self._GetTestFilePath([u"psort_test.proto.plaso"]) zip_file_object = zipfile.ZipFile(test_file, "r", zipfile.ZIP_DEFLATED, allowZip64=True) stream_name = u"plaso_timestamps.000003" offset_table = zip_file._SerializedDataTimestampTable(zip_file_object, stream_name) offset_table.Read() self.assertEqual(offset_table.GetTimestamp(0), 1390377181000000) self.assertEqual(offset_table.GetTimestamp(1), 1390377241000000) with self.assertRaises(IndexError): offset_table.GetTimestamp(2) self.assertEqual(offset_table.GetTimestamp(-1), 1390377241000000) self.assertEqual(offset_table.GetTimestamp(-2), 1390377181000000) with self.assertRaises(IndexError): offset_table.GetTimestamp(-3)
def testGetTimestamp(self): """Tests the GetTimestamp function.""" test_file = self._GetTestFilePath([u'psort_test.json.plaso']) zip_file_object = zipfile.ZipFile( test_file, 'r', zipfile.ZIP_DEFLATED, allowZip64=True) stream_name = u'plaso_timestamps.000002' offset_table = zip_file._SerializedDataTimestampTable( zip_file_object, stream_name) offset_table.Read() self.assertEqual(offset_table.GetTimestamp(0), 1453449153000000) self.assertEqual(offset_table.GetTimestamp(1), 1453449153000000) with self.assertRaises(IndexError): offset_table.GetTimestamp(99) self.assertEqual(offset_table.GetTimestamp(-1), 1542503743000000) self.assertEqual(offset_table.GetTimestamp(-2), 1542503720000000) with self.assertRaises(IndexError): offset_table.GetTimestamp(-99)
def testGetTimestamp(self): """Tests the GetTimestamp function.""" test_file = self._GetTestFilePath([u'psort_test.json.plaso']) zip_file_object = zipfile.ZipFile( test_file, 'r', zipfile.ZIP_DEFLATED, allowZip64=True) stream_name = u'event_timestamps.000002' offset_table = zip_file._SerializedDataTimestampTable( zip_file_object, stream_name) offset_table.Read() self.assertEqual(offset_table.GetTimestamp(0), 1453449153000000) self.assertEqual(offset_table.GetTimestamp(1), 1453449153000000) with self.assertRaises(IndexError): offset_table.GetTimestamp(99) self.assertEqual(offset_table.GetTimestamp(-1), 1483206872000000) self.assertEqual(offset_table.GetTimestamp(-2), 1482083672000000) with self.assertRaises(IndexError): offset_table.GetTimestamp(-99)