def test_consistent_error_messages_required(self): error = jsonschema.ValidationError( "%r is a required property" % u'name', validator=u'required') msg = validator._get_consistent_error_message(error) self.assertEqual(msg, "'name' is a required property") error = jsonschema.ValidationError( "u'name' is a required property", validator=u'required') msg = validator._get_consistent_error_message(error) self.assertEqual(msg, "'name' is a required property")
def test_consistent_error_messages_oneOf(self): error = jsonschema.ValidationError( "%r is not one of %r" % (u'type', [u'vlan', u'interface']), validator=u'enum', validator_value=[u'vlan', u'interface'], instance=u'type') msg = validator._get_consistent_error_message(error) self.assertEqual(msg, "'type' is not one of ['vlan','interface']")
def test_consistent_error_messages_type(self): error = jsonschema.ValidationError("%r is not of type %r" % (u'name', u'string'), validator=u'type', validator_value=u'string', instance=u'name') msg = validator._get_consistent_error_message(error) self.assertEqual(msg, "'name' is not of type 'string'")
def test_consistent_error_messages_type(self): error = jsonschema.ValidationError( "%r is not of type %r" % (u'name', u'string'), validator=u'type', validator_value=u'string', instance=u'name') msg = validator._get_consistent_error_message(error) self.assertEqual(msg, "'name' is not of type 'string'")