Add simple validation test case
This commit is contained in:
parent
de96888d40
commit
2106256f89
1 changed files with 20 additions and 0 deletions
20
test.py
20
test.py
|
@ -38,5 +38,25 @@ class TestBaseAPI(tornado.testing.AsyncHTTPTestCase):
|
|||
self.assertEqual(response.body.decode(), oas3f.read(), "OAS3 content differs from spec file!")
|
||||
|
||||
|
||||
class TestValidation(tornado.testing.AsyncHTTPTestCase):
|
||||
"""Validation test cases"""
|
||||
def get_app(self):
|
||||
return make_app()
|
||||
|
||||
def test_null_validation(self):
|
||||
entity = {}
|
||||
|
||||
response = self.fetch('/v0/validate',
|
||||
method='POST',
|
||||
body=json.dumps(entity))
|
||||
|
||||
self.assertEqual(200, response.code, "Validation must always return 200")
|
||||
|
||||
validation_result = json.loads(response.body.decode())
|
||||
|
||||
self.assertIn('valid', validation_result, "Key 'valid' expected in validation result")
|
||||
self.assertTrue(validation_result['valid'], "Validation result is expected to be valid==true")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in a new issue