Example #1
0
 def test_oas_20_invalid(self):
     with pytest.raises(schemas.SchemaValidationError) as excinfo:
         schemas.validate({
             'swagger': '2.0',
             'should': 'not be here',
         })
     for error in excinfo.value.errors:
         assert isinstance(error, ValidationError)
Example #2
0
 def test_oas_20_valid(self):
     assert schemas.validate({
         'swagger': '2.0',
         'info': {
             'title': 'An empty minimal specification',
             'version': '1.0',
         },
         'paths': {},
     })
Example #3
0
 def test_unknown_version(self):
     with pytest.raises(errors.SpecsError):
         schemas.validate({'swagger': '42.0'})
Example #4
0
 def test_unknown_schema(self):
     with pytest.raises(errors.SpecsError):
         schemas.validate({'valid': 'no'})