diff env/lib/python3.9/site-packages/cwltool/tests/test_http_input.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/env/lib/python3.9/site-packages/cwltool/tests/test_http_input.py	Mon Mar 22 18:12:50 2021 +0000
@@ -0,0 +1,27 @@
+import os
+from pathlib import Path
+from typing import List
+
+from cwltool.pathmapper import PathMapper
+from cwltool.utils import CWLObjectType
+
+
+def test_http_path_mapping(tmp_path: Path) -> None:
+
+    input_file_path = "https://raw.githubusercontent.com/common-workflow-language/cwltool/main/tests/2.fasta"
+    base_file: List[CWLObjectType] = [
+        {
+            "class": "File",
+            "location": "https://raw.githubusercontent.com/common-workflow-language/cwltool/main/tests/2.fasta",
+            "basename": "chr20.fa",
+        }
+    ]
+    pathmap = PathMapper(base_file, os.getcwd(), str(tmp_path))._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