Mercurial > repos > guerler > springsuite
diff planemo/lib/python3.7/site-packages/cwltool/tests/test_http_input.py @ 0:d30785e31577 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author | guerler |
---|---|
date | Fri, 31 Jul 2020 00:18:57 -0400 (2020-07-31) |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/planemo/lib/python3.7/site-packages/cwltool/tests/test_http_input.py Fri Jul 31 00:18:57 2020 -0400 @@ -0,0 +1,26 @@ +import os +import tempfile + +from cwltool.pathmapper import PathMapper + + +def test_http_path_mapping(): + class SubPathMapper(PathMapper): + def __init__(self, referenced_files, basedir, stagedir): + super(SubPathMapper, self).__init__(referenced_files, basedir, stagedir) + input_file_path = "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/tests/2.fasta" + tempdir = tempfile.mkdtemp() + base_file = [{ + "class": "File", + "location": "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/tests/2.fasta", + "basename": "chr20.fa" + }] + pathmap = SubPathMapper(base_file, os.getcwd(), tempdir)._pathmap + + assert input_file_path in pathmap + assert os.path.exists(pathmap[input_file_path].resolved) + + with open(pathmap[input_file_path].resolved) as file: + contents = file.read() + + assert ">Sequence 561 BP; 135 A; 106 C; 98 G; 222 T; 0 other;" in contents