mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-20 06:19:17 +08:00
Keep automatic update reminders on the latest stable release, pin upgrades to the confirmed version, and require --allow-prerelease for CLI beta installs. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
"""Integration tests for /api/update."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
async def test_update_status_shape(env_admin_client: Any) -> None:
|
|
c, auth = env_admin_client
|
|
r = await c.get("/api/update/status", headers=auth)
|
|
assert r.status_code == 200
|
|
body = r.json()
|
|
for key in (
|
|
"current_version",
|
|
"latest_version",
|
|
"has_update",
|
|
"is_editable",
|
|
"service_mode",
|
|
"desktop",
|
|
"error",
|
|
"last_check_time",
|
|
"release_notes",
|
|
"stable_only",
|
|
"latest_is_prerelease",
|
|
):
|
|
assert key in body
|
|
|
|
|
|
async def test_update_check_admin_only(env_admin_client: Any) -> None:
|
|
c, auth = env_admin_client
|
|
r = await c.post("/api/update/check", headers=auth)
|
|
assert r.status_code == 200
|
|
|
|
|
|
async def test_update_settings_stable_only_roundtrip(env_admin_client: Any) -> None:
|
|
c, auth = env_admin_client
|
|
r = await c.patch("/api/update/settings", json={"stable_only": False}, headers=auth)
|
|
assert r.status_code == 200
|
|
assert r.json()["stable_only"] is False
|
|
status = await c.get("/api/update/status", headers=auth)
|
|
assert status.status_code == 200
|
|
assert status.json()["stable_only"] is False
|
|
r = await c.patch("/api/update/settings", json={"stable_only": True}, headers=auth)
|
|
assert r.status_code == 200
|
|
assert r.json()["stable_only"] is True
|