summaryrefslogtreecommitdiffstats
path: root/test/operation/test_responses.py
diff options
context:
space:
mode:
authorSastry Isukapalli <sastry@research.att.com>2018-03-27 17:23:40 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-27 17:23:40 +0000
commita775ec8b904a0ea7ed863726ffe7f7d9b363d47a (patch)
tree890e6ecab0262132c7f08c6df1ac5177c4b30f3c /test/operation/test_responses.py
parent477092abdb41449158538dfd49d8cd25c5c8e42a (diff)
parentf1e95cd95c05be145c3fde9f08404724937edf49 (diff)
Merge "Updates to address new HPA policies"
Diffstat (limited to 'test/operation/test_responses.py')
-rw-r--r--test/operation/test_responses.py43
1 files changed, 5 insertions, 38 deletions
diff --git a/test/operation/test_responses.py b/test/operation/test_responses.py
index 2e089ec..c023ef2 100644
--- a/test/operation/test_responses.py
+++ b/test/operation/test_responses.py
@@ -27,22 +27,11 @@ class TestLocalPolicies(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(self.__class__, self).__init__(*args, **kwargs)
self.folder = './test/policy-local-files'
- self.invalid_policies = ['INVALID-one.json', 'INVALID-two.json']
- self.valid_policies = [
- 'Affinity_vCPE_1.json',
- 'Capacity_vG_1.json',
- 'Distance_vG_1.json',
- 'Placement_Optimization_1.json',
- 'hpa_policy_vGMuxInfra_1.json',
- 'vnfPolicy_vG.json',
- 'Capacity_vGMuxInfra.json',
- 'Distance_vGMuxInfra_1.json',
- 'Min_Guarantee_vGMuxInfra_1.json',
- 'QueryPolicy_vCPE.json',
- 'hpa_policy_vG_1.json',
- 'vnfPolicy_vGMuxInfra.json'
- ]
-
+ self.valid_policies_file = self.folder + '/' + 'meta-valid-policies.txt'
+ self.invalid_policies_file = self.folder + '/' + 'meta-invalid-policies.txt'
+ self.valid_policies = local_policies.get_policy_names_from_file(self.valid_policies_file)
+ self.invalid_policies = local_policies.get_policy_names_from_file(self.invalid_policies_file)
+
def test_get_local_policies_no_policies(self):
with self.assertRaises(FileNotFoundError):
res = local_policies.get_local_policies(self.folder, self.invalid_policies)
@@ -60,25 +49,3 @@ class TestLocalPolicies(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
-
-from flask import Response
-
-from osdf import ACCEPTED_MESSAGE_TEMPLATE
-
-
-def osdf_response_for_request_accept(req_id="", text="", response_code=202, as_http=True):
- """Helper method to create a response object for request acceptance, so that the object can be sent to a client
- :param req_id: request ID provided by the caller
- :param text: extra text description about accepting the request (e.g. "Request accepted")
- :param response_code: the HTTP status code to send -- default is 202 (accepted)
- :param as_http: whether to send response as HTTP response object or as a string
- :return: if as_http is True, return a HTTP Response object. Otherwise, return json-encoded-message
- """
- response_message = ACCEPTED_MESSAGE_TEMPLATE.render(description=text, request_id=req_id)
- if not as_http:
- return response_message
-
- response = Response(response_message, content_type='application/json; charset=utf-8')
- response.headers.add('content-length', len(response_message))
- response.status_code = response_code
- return response