Removed unused DB-adapters, test cases, 60+% cover
[optf/osdf.git] / test / test_api_validation.py
1 import json
2 import unittest
3
4 from osdf.models.api.placementRequest import PlacementAPI
5 from osdf.models.api.placementResponse import PlacementResponse
6 from schematics.exceptions import ModelValidationError
7
8
9 class TestReqValidation(unittest.TestCase):
10
11     def test_req_validation(self):
12         req_file = "./test/placement-tests/request.json"
13         req_json = json.loads(open(req_file).read())
14         self.assertEqual(PlacementAPI(req_json).validate(), None)
15
16     def test_req_failure(self):
17         req_json = {}
18         self.assertRaises(ModelValidationError, lambda: PlacementAPI(req_json).validate())
19
20
21 class TestResponseValidation(unittest.TestCase):
22
23     def test_invalid_response(self):
24         resp_json = {}
25         self.assertRaises(ModelValidationError, lambda: PlacementResponse(resp_json).validate())
26
27
28 if __name__ == "__main__":
29     unittest.main()