Skip to content

Commit 8003d55

Browse files
authored
Add CLI test for crate-version
1 parent 3a63d3e commit 8003d55

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/test_cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ def test_cli_init(test_data_dir, helpers, monkeypatch, cwd, gen_preview):
119119
assert "sort-and-change-case.ga" in json_entities
120120
assert json_entities["sort-and-change-case.ga"]["@type"] == "File"
121121

122+
@pytest.mark.parametrize("version", ["1.0", "1.1"])
123+
def test_cli_init_version(test_data_dir, version):
124+
crate_dir = test_data_dir / "ro-crate-galaxy-sortchangecase"
125+
metadata_path = crate_dir / helpers.METADATA_FILE_NAME
126+
metadata_path.unlink()
127+
args = ["init", "-c", str(crate_dir), "--crate-version", version]
128+
129+
result = CliRunner().invoke(cli, args)
130+
131+
with metadata_path.open('r') as file:
132+
assert json.load(file)['@context'] == f"https://w3id.org/ro/crate/{version}/context"
122133

123134
def test_cli_init_exclude(test_data_dir, helpers):
124135
crate_dir = test_data_dir / "ro-crate-galaxy-sortchangecase"

0 commit comments

Comments
 (0)