Skip to content

Commit 27442fe

Browse files
committed
updated test
1 parent 4a4b012 commit 27442fe

1 file changed

Lines changed: 32 additions & 27 deletions

File tree

fri/test.py

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
from cgi import test
12
import requests
23
import os
34
import urllib.request
45

56
# function to test upload() method.
6-
def upload():
7-
url = "http://127.0.0.1:5000/upload/test?apikey=xyz"
87

9-
path = os.path.abspath("example.py")
8+
def upload(files):
9+
url = "http://127.0.0.1:5000/upload/test?apikey=xyz"
1010

1111
payload={}
12-
files=[
13-
('files[]',('example.py',open(path,'rb'),'application/octet-stream'))
14-
]
12+
# files=[
13+
# ('files[]',('example.py',open(path,'rb'),'application/octet-stream'))
14+
# ]
1515
headers = {}
1616

1717
response = requests.request("POST", url, headers=headers, data=payload, files=files)
@@ -37,34 +37,28 @@ def execute():
3737

3838
print(response.text)
3939

40-
# function to test download() method.
41-
def download():
42-
url = "http://127.0.0.1:5000/download/test?fetch=f1.txt&apikey=xyz"
43-
urllib.request.urlretrieve(url, "f1.txt")
44-
45-
4640
# function to check build
47-
def build():
48-
url = "http://127.0.0.1:5000/build/test?fetch=sample1"
41+
def build(dir, graphml, apikey):
42+
url = "http://127.0.0.1:5000/build/"+dir+"?"+"fetch="+graphml+"&"+"apikey="+apikey
4943
response = requests.request("POST", url)
5044
print(response.text)
5145

5246
# function to debug
53-
def debug():
54-
url = "http://127.0.0.1:5000/debug/sample1"
47+
def debug(graphml):
48+
url = "http://127.0.0.1:5000/debug/"+graphml
5549
response = requests.request("POST", url)
5650
print(response.text)
5751

5852

5953
#function to destroy dir.
60-
def destroy():
61-
url = "http://127.0.0.1:5000/destroy/sample1"
54+
def destroy(dir):
55+
url = "http://127.0.0.1:5000/destroy/" + dir
6256
response = requests.request("DELETE", url)
6357

6458
print(response.text)
6559

66-
def getFilesList():
67-
url = "http://127.0.0.1:5000/getFilesList/test"
60+
def getFilesList(dir):
61+
url = "http://127.0.0.1:5000/getFilesList/" + dir
6862
response = requests.request("POST", url)
6963
print(response.text)
7064

@@ -73,13 +67,24 @@ def openJupyter():
7367
response = requests.request("POST", url)
7468
print(response.text)
7569

70+
# function to test download() method.
71+
def download():
72+
url = "http://127.0.0.1:5000/download/test?fetch=f1.txt&apikey=xyz"
73+
urllib.request.urlretrieve(url, "f1.txt")
74+
75+
# file list to be uploaded
76+
files=[
77+
#('files[]',(file_name,open(file_path,'rb'),'application/octet-stream'))
78+
79+
]
7680

77-
# upload()
78-
# execute()
79-
# download()
80-
# build()
81-
# debug()
82-
# destroy()
83-
getFilesList()
81+
82+
upload(files)
83+
execute()
84+
build("test", "sample1", "xyz")
85+
debug("sample1")
86+
destroy("sample1")
87+
# getFilesList("fri")
8488
# openJupyter()
89+
# download()
8590

0 commit comments

Comments
 (0)