Skip to content

Commit 6a4d1f0

Browse files
committed
adding tset to check that input file is loaded over http/s
1 parent 04e0484 commit 6a4d1f0

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_http_input.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from __future__ import absolute_import
2+
import unittest
3+
import os
4+
import tempfile
5+
from cwltool.pathmapper import PathMapper
6+
7+
8+
class TestHttpInput(unittest.TestCase):
9+
def test_http_path_mapping(self):
10+
class SubPathMapper(PathMapper):
11+
def __init__(self, referenced_files, basedir, stagedir):
12+
super(SubPathMapper, self).__init__(referenced_files, basedir, stagedir)
13+
input_file_path = "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/tests/2.fasta"
14+
tempdir = tempfile.mkdtemp()
15+
base_file = [{
16+
"class": "File",
17+
"location": "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/tests/2.fasta",
18+
"basename": "chr20.fa"
19+
}]
20+
path_map_obj = SubPathMapper(base_file, os.getcwd(), tempdir)
21+
22+
self.assertIn(input_file_path,path_map_obj._pathmap)
23+
assert os.path.exists(path_map_obj._pathmap[input_file_path].resolved) == 1
24+
with open(path_map_obj._pathmap[input_file_path].resolved) as f:
25+
self.assertIn(">Sequence 561 BP; 135 A; 106 C; 98 G; 222 T; 0 other;",f.read())
26+
f.close()

0 commit comments

Comments
 (0)