test: add CLI query smoke test
This commit is contained in:
parent
60e852de84
commit
0ebb84a8d1
@ -5,3 +5,34 @@ def test_cli_has_subcommands():
|
||||
parser = build_parser()
|
||||
subparsers = parser._subparsers
|
||||
assert subparsers is not None
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from tcga_downloader.cli import main
|
||||
|
||||
|
||||
def test_cli_query_writes_manifest(tmp_path, monkeypatch):
|
||||
args = [
|
||||
"tcga-downloader",
|
||||
"query",
|
||||
"--project",
|
||||
"TCGA-BRCA",
|
||||
"--data-type",
|
||||
"Gene Expression",
|
||||
"--out",
|
||||
str(tmp_path / "m.tsv"),
|
||||
]
|
||||
monkeypatch.setattr("sys.argv", args)
|
||||
with patch("tcga_downloader.cli.query_files") as q:
|
||||
q.return_value = [
|
||||
{
|
||||
"file_id": "f1",
|
||||
"file_name": "a.tsv",
|
||||
"data_type": "Gene Expression",
|
||||
"data_format": "TSV",
|
||||
"file_size": 123,
|
||||
"md5sum": "abc",
|
||||
}
|
||||
]
|
||||
main()
|
||||
assert (tmp_path / "m.tsv").exists()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user