Left: | ||
Right: |
OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 """Tests for the storage factory.""" | 3 """Tests for the storage factory.""" |
4 | 4 |
5 from __future__ import unicode_literals | 5 from __future__ import unicode_literals |
6 | 6 |
7 import unittest | 7 import unittest |
8 | 8 |
9 from plaso.containers import sessions | 9 from plaso.containers import sessions |
10 from plaso.storage import factory | 10 from plaso.storage import factory |
11 from plaso.storage import sqlite_file | 11 from plaso.storage.sqlite import sqlite_file |
12 from plaso.storage.sqlite import reader as sqlite_reader | |
13 from plaso.storage.sqlite import writer as sqlite_writer | |
12 | 14 |
13 from tests import test_lib as shared_test_lib | 15 from tests import test_lib as shared_test_lib |
14 from tests.storage import test_lib | 16 from tests.storage import test_lib |
15 | 17 |
16 | 18 |
17 class StorageFactoryTest(test_lib.StorageTestCase): | 19 class StorageFactoryTest(test_lib.StorageTestCase): |
18 """Tests for the storage factory.""" | 20 """Tests for the storage factory.""" |
19 | 21 |
20 @shared_test_lib.skipUnlessHasTestFile(['psort_test.plaso']) | 22 @shared_test_lib.skipUnlessHasTestFile(['psort_test.plaso']) |
21 def testCreateStorageFileForFile(self): | 23 def testCreateStorageFileForFile(self): |
22 """Test the CreateStorageFileForFile function.""" | 24 """Test the CreateStorageFileForFile function.""" |
23 test_file = self._GetTestFilePath(['psort_test.plaso']) | 25 test_file = self._GetTestFilePath(['psort_test.plaso']) |
24 | 26 |
25 storage_file = factory.StorageFactory.CreateStorageFileForFile(test_file) | 27 storage_file = factory.StorageFactory.CreateStorageFileForFile(test_file) |
26 self.assertIsInstance(storage_file, sqlite_file.SQLiteStorageFile) | 28 self.assertIsInstance( |
Joachim Metz
2018/01/10 20:37:24
why the multi line changes? doesn't this fit on a
onager
2018/01/11 12:58:04
Done.
| |
29 storage_file, sqlite_file.SQLiteStorageFile) | |
27 | 30 |
28 @shared_test_lib.skipUnlessHasTestFile(['psort_test.plaso']) | 31 @shared_test_lib.skipUnlessHasTestFile(['psort_test.plaso']) |
29 def testCreateStorageReaderForFile(self): | 32 def testCreateStorageReaderForFile(self): |
30 """Test the CreateStorageReaderForFile function.""" | 33 """Test the CreateStorageReaderForFile function.""" |
31 test_file = self._GetTestFilePath(['psort_test.plaso']) | 34 test_file = self._GetTestFilePath(['psort_test.plaso']) |
32 | 35 |
33 storage_reader = factory.StorageFactory.CreateStorageReaderForFile( | 36 storage_reader = factory.StorageFactory.CreateStorageReaderForFile( |
34 test_file) | 37 test_file) |
35 self.assertIsInstance(storage_reader, sqlite_file.SQLiteStorageFileReader) | 38 self.assertIsInstance( |
39 storage_reader, sqlite_reader.SQLiteStorageFileReader) | |
36 | 40 |
37 @shared_test_lib.skipUnlessHasTestFile(['psort_test.plaso']) | 41 @shared_test_lib.skipUnlessHasTestFile(['psort_test.plaso']) |
38 def testCreateStorageWriterForFile(self): | 42 def testCreateStorageWriterForFile(self): |
39 """Test the CreateStorageWriterForFile function.""" | 43 """Test the CreateStorageWriterForFile function.""" |
40 session = sessions.Session() | 44 session = sessions.Session() |
41 test_file = self._GetTestFilePath(['psort_test.plaso']) | 45 test_file = self._GetTestFilePath(['psort_test.plaso']) |
42 | 46 |
43 storage_reader = factory.StorageFactory.CreateStorageWriterForFile( | 47 storage_reader = factory.StorageFactory.CreateStorageWriterForFile( |
44 session, test_file) | 48 session, test_file) |
45 self.assertIsInstance(storage_reader, sqlite_file.SQLiteStorageFileWriter) | 49 self.assertIsInstance( |
50 storage_reader, sqlite_writer.SQLiteStorageFileWriter) | |
46 | 51 |
47 | 52 |
48 if __name__ == '__main__': | 53 if __name__ == '__main__': |
49 unittest.main() | 54 unittest.main() |
OLD | NEW |