OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 """Tests for the output manager.""" | 3 """Tests for the output manager.""" |
4 | 4 |
5 import unittest | 5 import unittest |
6 | 6 |
7 from plaso.output import interface | 7 from plaso.output import interface |
8 from plaso.output import manager | 8 from plaso.output import manager |
9 | 9 |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 def testHasOutputClass(self): | 98 def testHasOutputClass(self): |
99 """Tests the HasOutputClass function.""" | 99 """Tests the HasOutputClass function.""" |
100 manager.OutputManager.RegisterOutput(TestOutput) | 100 manager.OutputManager.RegisterOutput(TestOutput) |
101 | 101 |
102 self.assertTrue(manager.OutputManager.HasOutputClass(u'test_output')) | 102 self.assertTrue(manager.OutputManager.HasOutputClass(u'test_output')) |
103 self.assertFalse(manager.OutputManager.HasOutputClass(u'bogus')) | 103 self.assertFalse(manager.OutputManager.HasOutputClass(u'bogus')) |
104 self.assertFalse(manager.OutputManager.HasOutputClass(1)) | 104 self.assertFalse(manager.OutputManager.HasOutputClass(1)) |
105 | 105 |
106 manager.OutputManager.DeregisterOutput(TestOutput) | 106 manager.OutputManager.DeregisterOutput(TestOutput) |
107 | 107 |
| 108 # TODO: add tests for IsLinearOutputModule. |
| 109 |
108 def testNewOutputModule(self): | 110 def testNewOutputModule(self): |
109 """Tests the NewOutputModule function.""" | 111 """Tests the NewOutputModule function.""" |
110 manager.OutputManager.RegisterOutput(TestOutput) | 112 manager.OutputManager.RegisterOutput(TestOutput) |
111 | 113 |
112 output_module = manager.OutputManager.NewOutputModule(u'test_output', None) | 114 output_module = manager.OutputManager.NewOutputModule(u'test_output', None) |
113 self.assertIsInstance(output_module, TestOutput) | 115 self.assertIsInstance(output_module, TestOutput) |
114 | 116 |
115 with self.assertRaises(ValueError): | 117 with self.assertRaises(ValueError): |
116 _ = manager.OutputManager.NewOutputModule(1, None) | 118 _ = manager.OutputManager.NewOutputModule(1, None) |
117 | 119 |
118 with self.assertRaises(KeyError): | 120 with self.assertRaises(KeyError): |
119 _ = manager.OutputManager.NewOutputModule(u'bogus', None) | 121 _ = manager.OutputManager.NewOutputModule(u'bogus', None) |
120 | 122 |
121 manager.OutputManager.DeregisterOutput(TestOutput) | 123 manager.OutputManager.DeregisterOutput(TestOutput) |
122 | 124 |
123 | 125 |
124 if __name__ == '__main__': | 126 if __name__ == '__main__': |
125 unittest.main() | 127 unittest.main() |
OLD | NEW |