Skip to content

Commit 08a40c2

Browse files
author
Will Trimble
committed
Changed blacklist to has of mg-rast.org uris
1 parent b7393e9 commit 08a40c2

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

Diff for: API-testing.py

+31-11
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323

2424

2525

26-
API_URL = "http://api.metagenomics.anl.gov/1"
26+
API_URL = "https://api.mg-rast.org/1"
2727

28-
SKIP = ["48f15d5aae95892edb9bae03988573fa",
29-
'3bfa44d3dad4e2af12bab2601cfa8138',
30-
'a78c50dc4b81f0d02fc0391532cc61f4',
31-
'c0a6a295563e01e7c42628cfe81b7431',
32-
'19fe36c957ab88a6b5a567d885db445c',
33-
'084905a84b75b6860c877a5804453829',
34-
'23bd3abcc793f83d87e16913c99ef5ac',
35-
'376206640f1592ac9302e30d7cf8fabb',
36-
'7017b76a86eee625ec9d954a6149dd12'] # these take too long
28+
# these take too long
29+
SKIP = ["48f15d5aae95892edb9bae03988573fa", '7017b76a86eee625ec9d954a6149dd12', 'bf0461f5474cd711525dcd104452005b', # annotation/sequence/mgm4447943.3?evalue=10&type=organism&source=SwissProt
30+
'3bfa44d3dad4e2af12bab2601cfa8138', '4978084e1997239e5ea92c873262585e', # annotation/similarity/mgm4447943.3?identity=80&type=function&source=KO
31+
'a78c50dc4b81f0d02fc0391532cc61f4', 'be43b392342e558d8285fda7ce6304d3', # download/mgm4447943.3?file=350.1
32+
'c0a6a295563e01e7c42628cfe81b7431', '093f18b3f9fdf63756d185ca3eb4600a', # compute/alphadiversity/mgm4447943.3?level=order
33+
'19fe36c957ab88a6b5a567d885db445c', '376206640f1592ac9302e30d7cf8fabb', # compute/rarefaction/mgm4447943.3?level=order
34+
'084905a84b75b6860c877a5804453829', '4978084e1997239e5ea92c873262585e', # annotation/similarity/mgm4447943.3?identity=80&type=function&source=KO
35+
'23bd3abcc793f83d87e16913c99ef5ac', '093f18b3f9fdf63756d185ca3eb4600a', # compute/alphadiversity/mgm4447943.3?level=order
36+
]
3737

3838

3939

@@ -71,7 +71,23 @@ def getmeajsonobject(url):
7171
def print_tests(testlist):
7272
for test in testlist:
7373
callhash, call, name, name2, description = test
74-
print(callhash, call, description)
74+
print("\t".join([callhash, call, description]))
75+
76+
def print_code(testlist):
77+
print("from subprocess import check_output")
78+
for test in testlist:
79+
callhash, call, name, name2, description = test
80+
if call[0:4] == "curl":
81+
print("def test_{}(): # {}".format(callhash, description))
82+
print(" CMD = '''{} 2> {}.err > {}.out'''".format(call, callhash, callhash))
83+
print(' o = check_output(CMD, shell=True)')
84+
elif call[0:4] == "http":
85+
print("def test_{}(): # {}".format(callhash, description))
86+
print(" URI = '''{}'''".format(call))
87+
print(" CMD = '''curl '{}' 2> {}.err > {}.out'''".format(call, callhash, callhash))
88+
print(' o = check_output("curl {}".format(URI), shell=True)')
89+
else:
90+
print("CALL", call)
7591

7692
def check_ok(stem, dir1, blesseddir):
7793
'''Populates a file called WORKING + stem + ".test" with symbols
@@ -214,6 +230,8 @@ def get_example_calls(base_url):
214230
default="", help="use output format JSON")
215231
parser.add_argument("-b", "--blesseddir", dest="blesseddir", type=str,
216232
default="data", help="Location of stored (good) results")
233+
parser.add_argument("-p", "--python", dest="python", action="store_true",
234+
help="output python test code")
217235
parser.add_argument("-w", "--workdingdir", dest="workingdir", type=str,
218236
default=".", help="Working dir--will be filled with output files")
219237
parser.add_argument("-t", "--test", dest="tests", action="store_true",
@@ -237,5 +255,7 @@ def get_example_calls(base_url):
237255
tests = get_example_calls(API_URL)
238256
if TESTS:
239257
print_tests(tests)
258+
elif opts.python:
259+
print_code(tests)
240260
else:
241261
run_tests(tests)

0 commit comments

Comments
 (0)