Enabled CVS for the OSDF placement API
[optf/osdf.git] / test / test_get_opt_query_data.py
1 # -------------------------------------------------------------------------\r
2 #   Copyright (c) 2017-2018 AT&T Intellectual Property\r
3 #\r
4 #   Licensed under the Apache License, Version 2.0 (the "License");\r
5 #   you may not use this file except in compliance with the License.\r
6 #   You may obtain a copy of the License at\r
7 #\r
8 #       http://www.apache.org/licenses/LICENSE-2.0\r
9 #\r
10 #   Unless required by applicable law or agreed to in writing, software\r
11 #   distributed under the License is distributed on an "AS IS" BASIS,\r
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13 #   See the License for the specific language governing permissions and\r
14 #   limitations under the License.\r
15 #\r
16 # -------------------------------------------------------------------------\r
17 #\r
18 import unittest\r
19 import json\r
20 from osdf.optimizers.placementopt.conductor.translation import get_opt_query_data\r
21 \r
22 \r
23 class TestGetOptQueryData(unittest.TestCase):\r
24 \r
25     def test_get_opt_query_data(self):\r
26         main_dir = ""\r
27         parameter_data_file = main_dir + "test/placement-tests/request.json"\r
28         policy_data_path = main_dir + "test/policy-local-files/"\r
29         \r
30         query_policy_data_file = ["QueryPolicy_vCPE.json"]\r
31         request_json = json.loads(open(parameter_data_file).read())\r
32         policies = [json.loads(open(policy_data_path + file).read()) for file in query_policy_data_file]\r
33         req_param_dict = get_opt_query_data(request_json, policies)\r
34         \r
35         self.assertTrue(req_param_dict is not None)\r
36 \r
37 \r
38 if __name__ == "__main__":\r
39     unittest.main()\r
40 \r