summaryrefslogtreecommitdiffstats
path: root/test/operation
diff options
context:
space:
mode:
authorAnkitkumar Patel <ankit@research.att.com>2018-03-27 11:54:53 -0400
committerAnkitkumar Patel <ankit@research.att.com>2018-03-27 11:55:13 -0400
commitf1e95cd95c05be145c3fde9f08404724937edf49 (patch)
tree9b189af4508a2450dc92132e761beebed18ec168 /test/operation
parent4de3bb8c9f62f15d6aeb965f9d4c47edb7efd2e9 (diff)
Updates to address new HPA policies
Issue-ID: OPTFRA-100 Change-Id: Iaff7b50dc5394546cc46591bef9b054cd6cde792 Signed-off-by: Ankitkumar Patel <ankit@research.att.com>
Diffstat (limited to 'test/operation')
-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