Report pending Registry activation accurately
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
@@ -56,3 +57,47 @@ def test_publish_keeps_token_out_of_arguments_and_environment(monkeypatch, tmp_p
|
||||
assert "private-token" not in repr(calls[1][0])
|
||||
assert "private-token" not in repr(publish_kwargs["env"])
|
||||
assert publish_kwargs["env"]["COMFY_NODE_CHANGELOG"] == "release notes"
|
||||
|
||||
|
||||
def test_registry_release_status_finds_exact_published_version(monkeypatch, tmp_path):
|
||||
(tmp_path / "pyproject.toml").write_text(
|
||||
'[project]\nname = "etk-from-list-index"\nversion = "1.0.0"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
class Response(BytesIO):
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.close()
|
||||
|
||||
payload = b'{"versions":[{"version":"1.0.0","status":"NodeVersionStatusPending"}]}'
|
||||
monkeypatch.setattr(
|
||||
publish_registry_release.urllib.request,
|
||||
"urlopen",
|
||||
lambda *args, **kwargs: Response(payload),
|
||||
)
|
||||
|
||||
assert publish_registry_release.registry_release_status(tmp_path) == (
|
||||
"etk-from-list-index",
|
||||
"1.0.0",
|
||||
"NodeVersionStatusPending",
|
||||
)
|
||||
|
||||
|
||||
def test_pending_registry_status_does_not_claim_latest_is_ready(
|
||||
monkeypatch, capsys, tmp_path
|
||||
):
|
||||
monkeypatch.setattr(
|
||||
publish_registry_release,
|
||||
"registry_release_status",
|
||||
lambda source: ("etk-from-list-index", "1.0.0", "NodeVersionStatusPending"),
|
||||
)
|
||||
|
||||
publish_registry_release.print_registry_install_status(tmp_path)
|
||||
|
||||
output = capsys.readouterr().out
|
||||
assert "comfy node install etk-from-list-index@1.0.0" in output
|
||||
assert "unavailable until" in output
|
||||
assert "etk-from-list-index@latest" not in output
|
||||
|
||||
Reference in New Issue
Block a user