LEFT | RIGHT |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 """Tests for the event tag index.""" | 3 """Tests for the event tag index.""" |
4 | 4 |
5 from __future__ import unicode_literals | 5 from __future__ import unicode_literals |
6 | 6 |
7 import os | 7 import os |
8 import unittest | 8 import unittest |
9 | 9 |
10 from plaso.storage import event_tag_index | 10 from plaso.storage import event_tag_index |
(...skipping 24 matching lines...) Expand all Loading... |
35 test_events = self._CreateTestEvents() | 35 test_events = self._CreateTestEvents() |
36 for event in test_events: | 36 for event in test_events: |
37 storage_file.AddEvent(event) | 37 storage_file.AddEvent(event) |
38 | 38 |
39 test_event_tags = self._CreateTestEventTags(test_events) | 39 test_event_tags = self._CreateTestEventTags(test_events) |
40 storage_file.AddEventTags(test_event_tags[:-1]) | 40 storage_file.AddEventTags(test_event_tags[:-1]) |
41 storage_file.AddEventTags(test_event_tags[-1:]) | 41 storage_file.AddEventTags(test_event_tags[-1:]) |
42 | 42 |
43 storage_file.Close() | 43 storage_file.Close() |
44 | 44 |
45 @shared_test_lib.skipUnlessHasTestFile(['psort_test.json.plaso']) | 45 @shared_test_lib.skipUnlessHasTestFile(['psort_test.plaso']) |
46 def testBuild(self): | 46 def testBuild(self): |
47 """Tests the _Build function.""" | 47 """Tests the _Build function.""" |
48 test_index = event_tag_index.EventTagIndex() | 48 test_index = event_tag_index.EventTagIndex() |
49 | 49 |
50 self.assertIsNone(test_index._index) | 50 self.assertIsNone(test_index._index) |
51 | 51 |
52 test_file = self._GetTestFilePath(['psort_test.json.plaso']) | 52 test_file = self._GetTestFilePath(['psort_test.plaso']) |
53 storage_file = sqlite_file.SQLiteStorageFile() | 53 storage_file = sqlite_file.SQLiteStorageFile() |
54 storage_file.Open(path=test_file) | 54 storage_file.Open(path=test_file) |
55 test_index._Build(storage_file) | 55 test_index._Build(storage_file) |
56 storage_file.Close() | 56 storage_file.Close() |
57 | 57 |
58 self.assertIsNotNone(test_index._index) | 58 self.assertIsNotNone(test_index._index) |
59 | 59 |
60 def testGetEventTagByIdentifier(self): | 60 def testGetEventTagByIdentifier(self): |
61 """Tests the GetEventTagByIdentifier function.""" | 61 """Tests the GetEventTagByIdentifier function.""" |
62 test_index = event_tag_index.EventTagIndex() | 62 test_index = event_tag_index.EventTagIndex() |
(...skipping 16 matching lines...) Expand all Loading... |
79 storage_file, event_identifier) | 79 storage_file, event_identifier) |
80 self.assertIsNone(event_tag) | 80 self.assertIsNone(event_tag) |
81 | 81 |
82 storage_file.Close() | 82 storage_file.Close() |
83 | 83 |
84 # TODO: add test for SetEventTag. | 84 # TODO: add test for SetEventTag. |
85 | 85 |
86 | 86 |
87 if __name__ == '__main__': | 87 if __name__ == '__main__': |
88 unittest.main() | 88 unittest.main() |
LEFT | RIGHT |