This commit is contained in:
1 parent
16019ee649
commit
329b7756f4
17 files changed
+754
-85
No files matched your search
@@ -260,6 +260,43 @@ def test_admin_can_publish_delta_update_and_download_zip(tmp_path):
|
||||
assert download.content == delta_payload
|
||||
|
||||
|
||||
def test_admin_can_publish_multiple_cumulative_delta_updates(tmp_path):
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from license_server import api
|
||||
from license_server.core import LicenseService
|
||||
from tests.license_test_keys import TEST_PRIVATE_KEY_PEM
|
||||
|
||||
service = LicenseService(db_path=tmp_path / "license.db", private_key_pem=TEST_PRIVATE_KEY_PEM)
|
||||
client = TestClient(api.create_app(service=service, admin_token="secret"))
|
||||
client.post("/admin/login", data={"admin_token": "secret"}, follow_redirects=False)
|
||||
|
||||
client.post(
|
||||
"/admin/update/publish",
|
||||
cookies={api.ADMIN_CSRF_COOKIE: "csrf-token"},
|
||||
data={"csrf_token": "csrf-token", "version": "3.3.9", "notes": "", "force": "1"},
|
||||
files={"installer": ("DouyinGuaji-3.3.9-Setup.exe", b"installer", "application/octet-stream")},
|
||||
)
|
||||
for from_version, payload in [("3.3.7", b"delta37"), ("3.3.8", b"delta38")]:
|
||||
resp = client.post(
|
||||
"/admin/update/publish-delta",
|
||||
cookies={api.ADMIN_CSRF_COOKIE: "csrf-token"},
|
||||
data={"csrf_token": "csrf-token", "from_version": from_version, "to_version": "3.3.9"},
|
||||
files={"delta_file": (f"DouyinGuaji-{from_version}_to_3.3.9_delta.zip", payload, "application/zip")},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
|
||||
manifest = client.get("/api/v1/update/manifest").json()
|
||||
deltas = manifest["delta"]
|
||||
|
||||
assert isinstance(deltas, list)
|
||||
assert [item["from_version"] for item in deltas] == ["3.3.7", "3.3.8"]
|
||||
assert deltas[0]["url"].endswith("/api/v1/update/download/DouyinGuaji-3.3.7_to_3.3.9_delta.zip")
|
||||
download = client.get("/api/v1/update/download/DouyinGuaji-3.3.7_to_3.3.9_delta.zip")
|
||||
assert download.status_code == 200
|
||||
assert download.content == b"delta37"
|
||||
|
||||
|
||||
def test_license_server_rejects_untrusted_host(tmp_path):
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
|
||||
Reference in new issue
Block a user