64 lines
1.6 KiB
Python
64 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from click.testing import CliRunner
|
|
|
|
import jprm
|
|
from .utils_test import json_load
|
|
from .utils_test import TEST_DATA_DIR
|
|
|
|
|
|
@pytest.mark.datafiles(
|
|
TEST_DATA_DIR / 'pluginA_1.0.0.zip',
|
|
TEST_DATA_DIR / 'pluginA_1.1.0.zip',
|
|
TEST_DATA_DIR / 'pluginB_1.0.0.zip',
|
|
) # type: ignore[untyped-decorator]
|
|
def test_repo_add(cli_runner: CliRunner, tmp_path: Path, datafiles: Path) -> None:
|
|
manifest_file = tmp_path / 'repo.json'
|
|
manifest_a = json_load(TEST_DATA_DIR / 'manifest_pluginA.json')
|
|
manifest_a2 = json_load(TEST_DATA_DIR / 'manifest_pluginA2.json')
|
|
manifest_ab = json_load(TEST_DATA_DIR / 'manifest_pluginAB.json')
|
|
|
|
cli_runner.invoke(
|
|
jprm.cli,
|
|
[
|
|
'--verbosity=debug',
|
|
'repo',
|
|
'add',
|
|
str(manifest_file),
|
|
str(datafiles / 'pluginA_1.0.0.zip'),
|
|
],
|
|
)
|
|
manifest = json_load(manifest_file)
|
|
assert manifest == manifest_a
|
|
|
|
cli_runner.invoke(
|
|
jprm.cli,
|
|
[
|
|
'--verbosity=debug',
|
|
'repo',
|
|
'add',
|
|
str(manifest_file),
|
|
str(datafiles / 'pluginA_1.1.0.zip'),
|
|
],
|
|
)
|
|
manifest = json_load(manifest_file)
|
|
assert manifest == manifest_a2
|
|
|
|
cli_runner.invoke(
|
|
jprm.cli,
|
|
[
|
|
'--verbosity=debug',
|
|
'repo',
|
|
'add',
|
|
str(manifest_file),
|
|
str(datafiles / 'pluginB_1.0.0.zip'),
|
|
],
|
|
)
|
|
manifest = json_load(manifest_file)
|
|
assert manifest == manifest_ab
|
|
for x in tmp_path.rglob('*'):
|
|
print(x)
|