summaryrefslogtreecommitdiffstats
path: root/test/test_api_validation.py
diff options
context:
space:
mode:
authordhebeha <dhebeha.mj71@wipro.com>2020-08-14 11:45:20 +0530
committerdhebeha <dhebeha.mj71@wipro.com>2020-08-14 11:46:13 +0530
commit01cd5da39097c948e4fba94eb785b60452c70af3 (patch)
tree029002a3ca33da6429fb3c94be9cc8c3111c1226 /test/test_api_validation.py
parentf16a36e97aae114d9168eff7a4d273891e00d387 (diff)
Change API layer for NSI selection
Issue-ID: OPTFRA-802 Signed-off-by: dhebeha <dhebeha.mj71@wipro.com> Change-Id: Ia7e36da8d9a4d1f3f8e8eb00a61e6b0b29fbbbf6
Diffstat (limited to 'test/test_api_validation.py')
-rw-r--r--test/test_api_validation.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_api_validation.py b/test/test_api_validation.py
index 73d03cd..50941e9 100644
--- a/test/test_api_validation.py
+++ b/test/test_api_validation.py
@@ -22,6 +22,7 @@ from schematics.exceptions import DataError
from apps.placement.models.api.placementRequest import PlacementAPI
from apps.placement.models.api.placementResponse import PlacementResponse
+from apps.slice_selection.models.api.nsi_selection_request import NSISelectionAPI
class TestReqValidation(unittest.TestCase):
@@ -36,6 +37,16 @@ class TestReqValidation(unittest.TestCase):
req_json = json.loads(open(req_file).read())
self.assertEqual(PlacementAPI(req_json).validate(), None)
+ def test_req_nsi_validation(self):
+ req_file = "./test/apps/slice_selection/nsi_selection_request.json"
+ req_json = json.loads(open(req_file).read())
+ self.assertEqual(NSISelectionAPI(req_json).validate(), None)
+
+ def test_req_invalid_nsi(self):
+ req_file = "./test/apps/slice_selection/nsi_selection_invalid_request.json"
+ req_json = json.loads(open(req_file).read())
+ self.assertRaises(DataError, lambda: NSISelectionAPI(req_json).validate())
+
def test_req_failure(self):
req_json = {}
self.assertRaises(DataError, lambda: PlacementAPI(req_json).validate())