summaryrefslogtreecommitdiffstats
path: root/src/test/resources/http-cache/third_party_proxy.py
diff options
context:
space:
mode:
authorSébastien Determe <sebastien.determe@intl.att.com>2019-04-30 13:28:41 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-30 13:28:41 +0000
commitcc58619d3f4410f47c0d6fa8ac25e3aa7ca51438 (patch)
tree2be4e98144ddb763e4f4aefc9d6813b752144846 /src/test/resources/http-cache/third_party_proxy.py
parent9507b7416ee595eb59e25c6797f3720c0a89767c (diff)
parent39d82def1e54d6584f41ab9f94d30c2057858c32 (diff)
Merge "Fix the get loop state logic"
Diffstat (limited to 'src/test/resources/http-cache/third_party_proxy.py')
-rwxr-xr-xsrc/test/resources/http-cache/third_party_proxy.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/resources/http-cache/third_party_proxy.py b/src/test/resources/http-cache/third_party_proxy.py
index f19aa0da4..0db977bb4 100755
--- a/src/test/resources/http-cache/third_party_proxy.py
+++ b/src/test/resources/http-cache/third_party_proxy.py
@@ -199,6 +199,18 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w+') as f:
f.write(self.data_string)
return True
+ elif self.path.startswith("/policy/api/v1/policytypes/") and http_type == "GET":
+ print "self.path start with /policy/api/v1/policytypes/, generating response json..."
+ jsonGenerated = "{\"policyTypeId\": \"onap.policies.controlloop.operational\",\"policyTypeVersion\": \"1.0.0\",\"policyId\": \"OPERATIONAL_z711F_v1_0_ResourceInstanceName1_tca\"}"
+ print "jsonGenerated: " + jsonGenerated
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ return True
else:
return False