diff --git a/fri/test.py b/fri/test.py index aabc5ac..aba9f95 100644 --- a/fri/test.py +++ b/fri/test.py @@ -1,16 +1,44 @@ import requests import os -url = "http://127.0.0.1:5000/multiple-files-upload" +# function to test upload() method. +def upload(): + url = "http://127.0.0.1:5000/upload/test?apikey=xyz" -path = os.path.abspath("example.py") + path = os.path.abspath("example.py") -payload={} -files=[ - ('files[]',('example.py',open( path,'rb'),'application/octet-stream')) -] -headers = {} + payload={} + files=[ + ('files[]',('example.py',open(path,'rb'),'application/octet-stream')) + ] + headers = {} -response = requests.request("POST", url, headers=headers, data=payload, files=files) + response = requests.request("POST", url, headers=headers, data=payload, files=files) + + return response.text + + +# # ******* + +# function to test execute() method. +def execute(): + url = "http://127.0.0.1:5000/execute/test?apikey=xyz" + + path = os.path.abspath("example.py") + + payload={} + files=[ + ('file',('example.py',open(path,'rb'),'application/octet-stream')) + ] + headers = {} + + response = requests.request("POST", url, headers=headers, data=payload, files=files) + + return response.text + + # ******** + # To Download call the url .../download/test?fetch=&apikey=xyz + +upload() +execute() -print(response.text)