aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/resources/http-cache/third_party_proxy.py
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2018-12-07 17:48:10 +0100
committersebdet <sebastien.determe@intl.att.com>2018-12-07 17:48:10 +0100
commit9d1f89cff526052bd28a24d4ac33b1fd54d76983 (patch)
tree1e7f2598b46433953dd1ab13be88803b7df1860a /src/test/resources/http-cache/third_party_proxy.py
parentd72d0d05d74f4125e8f36beea096aa7769d19eab (diff)
Add unit tests
Add test to policyClient + guard policyAttributes Issue-ID: CLAMP-252 Change-Id: I344a631cc1dfd38e87f61b34dcb1bb3dbb00625a Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/test/resources/http-cache/third_party_proxy.py')
-rwxr-xr-xsrc/test/resources/http-cache/third_party_proxy.py10
1 files changed, 10 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 a1092412..de40ca90 100755
--- a/src/test/resources/http-cache/third_party_proxy.py
+++ b/src/test/resources/http-cache/third_party_proxy.py
@@ -171,6 +171,15 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w') as f:
f.write(jsonGenerated)
return True
+ elif self.path.startswith("/pdp/api/") and http_type == "PUT" or http_type == "DELETE":
+ print "self.path start with /pdp/api/, copying body to response ..."
+ 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(self.data_string)) + "\", \"Content-Type\": \""+str(self.headers['Content-Type'])+"\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(self.data_string)
+ return True
else:
return False
@@ -328,6 +337,7 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
cached_file_header=""
print("\n\n\nGot a DELETE for %s " % self.path)
self.check_credentials()
+ self.data_string = self.rfile.read(int(self.headers['Content-Length']))
print("self.headers:\n %s" % self.headers)
is_special = self._execute_content_generated_cases("DELETE")