Six fixes. The CHANGELOG has an entry for each. - Queue the legacy ComfyUI update and answer failed version requests - Check out a branch head by its name with GitPython - Follow the update policy when an update request names no version line - Print the messages of manager_core as they are - Refuse a db_mode or update_policy request the servers cannot use - Keep a setting chosen while the legacy menu is loading it The E2E cases wait for the Registry list, which a fresh environment has not cached, and the Playwright cases no longer depend on the timing of the UI.
24 lines
1.1 KiB
Python
24 lines
1.1 KiB
Python
"""`openapi.yaml` lists, for `db_mode` and the update policy, the values the routes accept."""
|
|
import ast
|
|
|
|
import pytest
|
|
import yaml
|
|
|
|
from legacy_html_testutil import PACKAGE
|
|
|
|
SPEC = yaml.safe_load((PACKAGE.parent / "openapi.yaml").read_text(encoding="utf-8"))
|
|
ACCEPTED = {node.targets[0].id: ast.literal_eval(node.value)
|
|
for node in ast.parse((PACKAGE / "glob/utils/environment_utils.py").read_text(encoding="utf-8")).body
|
|
if isinstance(node, ast.Assign) and getattr(node.targets[0], "id", "").startswith("ALLOWED_")}
|
|
|
|
|
|
@pytest.mark.parametrize("route, accepted", [
|
|
("/v2/manager/db_mode", "ALLOWED_DB_MODES"),
|
|
("/v2/manager/policy/update", "ALLOWED_UPDATE_POLICIES"),
|
|
])
|
|
def test_values_of_a_setting_route_are_the_ones_the_route_accepts(route, accepted):
|
|
answered = SPEC["paths"][route]["get"]["responses"]["200"]["content"]["text/plain"]["schema"]["enum"]
|
|
asked = SPEC["paths"][route]["post"]["requestBody"]["content"]["application/json"]["schema"]["properties"]["value"]["enum"]
|
|
|
|
assert sorted(answered) == sorted(asked) == sorted(ACCEPTED[accepted])
|