33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from pathlib import Path
|
|
|
|
from gpu_rent.manifests import parse_extensions, parse_models
|
|
|
|
|
|
def test_models_skips_version_zero(tmp_path: Path):
|
|
path = tmp_path / "models.yaml"
|
|
path.write_text(
|
|
"checkpoint:\n - version_id: 0\n - version_id: 123\n - url: https://civitai.red/models/1?modelVersionId=9\n",
|
|
encoding="utf-8",
|
|
)
|
|
entries = parse_models(path)
|
|
assert len(entries) == 2
|
|
assert entries[0].version_id == 123
|
|
assert entries[1].url.endswith("9")
|
|
|
|
|
|
def test_extensions_empty_file(tmp_path: Path):
|
|
path = tmp_path / "extensions.yaml"
|
|
path.write_text("swarmui: []\ncomfy: []\n", encoding="utf-8")
|
|
assert parse_extensions(path) == []
|
|
|
|
|
|
def test_extensions_repo(tmp_path: Path):
|
|
path = tmp_path / "extensions.yaml"
|
|
path.write_text(
|
|
"swarmui:\n - url: https://github.com/org/Ext.git\n ref: main\n dir: Ext\n",
|
|
encoding="utf-8",
|
|
)
|
|
repos = parse_extensions(path)
|
|
assert repos[0].kind == "swarmui"
|
|
assert repos[0].directory == "Ext"
|