Skip to content

Commit 5930d4a

Browse files
committed
Remove bravado req and add testing for the new client functions.
1 parent 6d05514 commit 5930d4a

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
install_requires=[
2626
'future',
2727
'connexion==1.4.2',
28-
'bravado==10.1.0',
2928
'ruamel.yaml >= 0.12.4, < 0.15',
3029
'cwlref-runner==1.0',
3130
'schema-salad>=2.6, <3',

test/test_integration.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def setUpClass(cls):
2828
cls.wdl_json_input = "file://" + os.path.abspath('testdata/md5sum.wdl.json')
2929
cls.wdl_attachments = ['file://' + os.path.abspath('testdata/md5sum.input')]
3030

31-
# houses the API methods
31+
# client for the swagger API methods
3232
cls.client = WESClient({'auth': '', 'proto': 'http', 'host': 'localhost:8080'})
3333

3434
# manual test (wdl only working locally atm)
@@ -76,6 +76,39 @@ def test_run_attachments(self):
7676
attachment_tool_path = get_response["workflow_attachment"][7:] + "/dockstore-tool-md5sum.cwl"
7777
self.assertTrue(check_for_file(attachment_tool_path), 'Attachment file was not found: ' + get_response["workflow_attachment"])
7878

79+
def test_get_service_info(self):
80+
"""
81+
Test wes_client.util.WESClient.get_service_info()
82+
83+
This method will exit(1) if the response is not 200.
84+
"""
85+
r = self.client.get_service_info()
86+
assert 'workflow_type_versions' in r
87+
assert 'supported_wes_versions' in r
88+
assert 'supported_filesystem_protocols' in r
89+
assert 'engine_versions' in r
90+
91+
def test_list_runs(self):
92+
"""
93+
Test wes_client.util.WESClient.list_runs()
94+
95+
This method will exit(1) if the response is not 200.
96+
"""
97+
r = self.client.list_runs()
98+
assert 'workflows' in r
99+
100+
def test_get_run_status(self):
101+
"""
102+
Test wes_client.util.WESClient.run_status()
103+
104+
This method will exit(1) if the response is not 200.
105+
"""
106+
outfile_path, run_id = self.run_md5sum(wf_input=self.cwl_local_path,
107+
json_input=self.cwl_json_input,
108+
workflow_attachment=self.cwl_attachments)
109+
r = self.client.get_run_status(run_id)
110+
assert 'state' in r
111+
assert 'run_id' in r
79112

80113
def run_md5sum(self, wf_input, json_input, workflow_attachment=None):
81114
"""Pass a local md5sum cwl to the wes-service server, and return the path of the output file that was created."""
@@ -136,14 +169,15 @@ def test_local_wdl(self):
136169
"""LOCAL md5sum wdl to the wes-service server, and check for the correct output."""
137170
# Working locally but not on travis... >.<;
138171
if self.manual:
139-
outfile_path, run_id = run_md5sum(wf_input=self.wdl_local_path,
140-
json_input=self.wdl_json_input,
141-
workflow_attachment=self.wdl_attachments)
172+
outfile_path, run_id = self.run_md5sum(wf_input=self.wdl_local_path,
173+
json_input=self.wdl_json_input,
174+
workflow_attachment=self.wdl_attachments)
142175
self.assertTrue(check_for_file(outfile_path), 'Output file was not found: ' + str(outfile_path))
143176

144177

145178
# Prevent pytest/unittest's discovery from attempting to discover the base test class.
146179
del IntegrationTest
147180

181+
148182
if __name__ == '__main__':
149183
unittest.main() # run all tests

0 commit comments

Comments
 (0)