mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-10-27 23:28:03 +09:00
One-click PowerShell entry point that spins up Ubuntu/Debian VMs in parallel, installs ServerKit from the local working tree (not origin/main), runs a pytest API harness against the live panel, and aggregates results into a self-contained HTML report. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
import pytest
|
|
|
|
|
|
def test_list_plugins_empty(http, base_url, auth_headers):
|
|
r = http.get(f"{base_url}/api/v1/plugins", headers=auth_headers, timeout=15)
|
|
assert r.status_code == 200, r.text
|
|
body = r.json()
|
|
# accept either {"plugins": [...]} or a bare list
|
|
if isinstance(body, dict):
|
|
assert "plugins" in body
|
|
else:
|
|
assert isinstance(body, list)
|
|
|
|
|
|
@pytest.mark.skipif(
|
|
True,
|
|
reason="install-from-URL hits GitHub; enable when a stable test plugin repo exists",
|
|
)
|
|
def test_install_plugin_from_url(http, base_url, auth_headers):
|
|
# Placeholder — wire to a known-good test plugin repo once one exists.
|
|
r = http.post(
|
|
f"{base_url}/api/v1/plugins/install",
|
|
headers=auth_headers,
|
|
json={"url": "https://github.com/jhd3197/serverkit-gui"},
|
|
timeout=120,
|
|
)
|
|
assert r.status_code in (200, 201), r.text
|
|
plugin = r.json()
|
|
pid = plugin["id"]
|
|
|
|
# disable
|
|
r = http.post(
|
|
f"{base_url}/api/v1/plugins/{pid}/disable", headers=auth_headers, timeout=15
|
|
)
|
|
assert r.status_code == 200, r.text
|
|
|
|
# enable
|
|
r = http.post(
|
|
f"{base_url}/api/v1/plugins/{pid}/enable", headers=auth_headers, timeout=15
|
|
)
|
|
assert r.status_code == 200, r.text
|
|
|
|
# uninstall
|
|
r = http.delete(
|
|
f"{base_url}/api/v1/plugins/{pid}", headers=auth_headers, timeout=30
|
|
)
|
|
assert r.status_code in (200, 204), r.text
|