Exemplo n.º 1
0
 def test_validate_raises_error_when_invalid(self):
     with self.assertRaises(pkgschema.ValidationError):
         pkgschema.validate_schema(self.schema, {})
     with self.assertRaises(pkgschema.ValidationError):
         pkgschema.validate_schema(self.schema, {'test': 1})
     with self.assertRaises(pkgschema.ValidationError):
         pkgschema.validate_schema(self.schema, {'test': 'ok', 'extra': 2})
Exemplo n.º 2
0
 def test_exception_string_returns_string(self):
     try:
         pkgschema.validate_schema(self.schema, {})
     except pkgschema.ValidationError as err:
         self.assertIsInstance(str(err), str)
Exemplo n.º 3
0
 def test_validate_returns_None_when_valid(self):
     obj = {'test': 'ok'}
     self.assertIsNone(pkgschema.validate_schema(self.schema, obj))
Exemplo n.º 4
0
 def test_full_metadata(self):
     obj = Object(self.full_options)
     metadata = obj.to_metadata()
     self.assertEqual(self.full_metadata, metadata)
     self.assertIsNone(validate_schema(self.mode_schema, metadata))