tcga-downloader/tests/test_cli.py
yunpeng.zhang a01a59b371
Some checks failed
CI / Lint (push) Failing after 9m32s
CI / Test (3.11) (push) Successful in 6m41s
CI / Test (3.12) (push) Successful in 4m21s
feat: add interactive cli
2026-02-09 13:13:39 +08:00

37 lines
925 B
Python

from unittest.mock import patch
from tcga_downloader.cli import build_parser, main
def test_cli_has_subcommands():
parser = build_parser()
subparsers = parser._subparsers
assert subparsers is not None
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()