Merge "add error logs to storperf"
[yardstick.git] / yardstick / tests / unit / common / test_template_format.py
index 56253ef..6e4827e 100644 (file)
@@ -22,16 +22,21 @@ from yardstick.common import template_format
 
 class TemplateFormatTestCase(unittest.TestCase):
 
-    def test_parse_to_value_exception(self):
+    def test_parse_scanner(self):
 
-        # TODO(elfoley): Don't hide the error that occurs in
-        # template_format.parse
-        # TODO(elfoley): Separate these tests; one per error type
         with mock.patch.object(yaml, 'load') as yaml_loader:
             yaml_loader.side_effect = yaml.scanner.ScannerError()
             self.assertRaises(ValueError, template_format.parse, 'FOOBAR')
+
+    def test_parse_parser(self):
+
+        with mock.patch.object(yaml, 'load') as yaml_loader:
             yaml_loader.side_effect = yaml.parser.ParserError()
             self.assertRaises(ValueError, template_format.parse, 'FOOBAR')
+
+    def test_parse_reader(self):
+
+        with mock.patch.object(yaml, 'load') as yaml_loader:
             yaml_loader.side_effect = \
                 yaml.reader.ReaderError('', '', '', '', '')
             self.assertRaises(ValueError, template_format.parse, 'FOOBAR')