Ejemplo n.º 1
0
 def test_procces_with_single_doc(self, pretty_mock):
     eh = val.ErrorHandler('error', 'ymlfile', 'schemafile')
     messages = []
     error = mock.MagicMock()
     error.message = "Some error message"
     eh.process(1, [1, 2], error, messages)
     assert pretty_mock.called
     pretty_mock.assert_called_with(1, 3, error, messages)
Ejemplo n.º 2
0
 def test_process_docline_docnum_mismatch(self, pretty_mock):
     eh = val.ErrorHandler('error', 'ymlfile', 'schemafile')
     messages = []
     error = mock.MagicMock()
     error.message = "Some error message"
     eh.process(1, [1, 2, 3, 4], error, messages)
     assert pretty_mock.called
     pretty_mock.assert_called_with(3, 4, error, messages)
Ejemplo n.º 3
0
 def test_process_bad_root_object(self):
     eh = val.ErrorHandler('error', 'ymlfile', 'schemafile')
     messages = []
     error = mock.MagicMock()
     error.message = "this is not of type u'object'"
     eh.process(1, [1, 2], error, messages)
     assert len(messages) == 1
     assert messages[0] == "Invalid root object in YAML. Check format."
Ejemplo n.º 4
0
 def test_error_handler_init(self):
     eh = val.ErrorHandler('error', 'ymlfile', 'schemafile')
     assert eh.error == 'error'
     assert eh.ymlfile == 'ymlfile'
     assert eh.schemafile == 'schemafile'
Ejemplo n.º 5
0
 def test_error_handler_init(self):
     eh = val.ErrorHandler("error", "ymlfile", "schemafile")
     assert eh.error == "error"
     assert eh.ymlfile == "ymlfile"
     assert eh.schemafile == "schemafile"