Skip to content

Commit 72fc6e4

Browse files
authored
Merge pull request #6 from amit-62/dev
updated test methods
2 parents 00b9f1f + 40e2e40 commit 72fc6e4

1 file changed

Lines changed: 37 additions & 9 deletions

File tree

fri/test.py

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,44 @@
11
import requests
22
import os
33

4-
url = "http://127.0.0.1:5000/multiple-files-upload"
4+
# function to test upload() method.
5+
def upload():
6+
url = "http://127.0.0.1:5000/upload/test?apikey=xyz"
57

6-
path = os.path.abspath("example.py")
8+
path = os.path.abspath("example.py")
79

8-
payload={}
9-
files=[
10-
('files[]',('example.py',open( path,'rb'),'application/octet-stream'))
11-
]
12-
headers = {}
10+
payload={}
11+
files=[
12+
('files[]',('example.py',open(path,'rb'),'application/octet-stream'))
13+
]
14+
headers = {}
1315

14-
response = requests.request("POST", url, headers=headers, data=payload, files=files)
16+
response = requests.request("POST", url, headers=headers, data=payload, files=files)
17+
18+
return response.text
19+
20+
21+
# # *******
22+
23+
# function to test execute() method.
24+
def execute():
25+
url = "http://127.0.0.1:5000/execute/test?apikey=xyz"
26+
27+
path = os.path.abspath("example.py")
28+
29+
payload={}
30+
files=[
31+
('file',('example.py',open(path,'rb'),'application/octet-stream'))
32+
]
33+
headers = {}
34+
35+
response = requests.request("POST", url, headers=headers, data=payload, files=files)
36+
37+
return response.text
38+
39+
# ********
40+
# To Download call the url .../download/test?fetch=<filename>&apikey=xyz
41+
42+
upload()
43+
execute()
1544

16-
print(response.text)

0 commit comments

Comments
 (0)