Render markdown in gist and project sidebar titles; add content visibility and GIF picker
DevPlace CI / test (push) Failing after 1h5m29s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 17:59:21 +01:00
co-authored by Claude Sonnet 5.5
parent bc11475f29
commit 05d6633204
154 changed files with 6394 additions and 289 deletions
+137
View File
@@ -331,6 +331,71 @@ def test_model_edit_page_404_for_missing_model(seeded_db):
)
def test_model_test_marks_unreachable_route_bad(seeded_db):
admin = admin_session(seeded_db)
provider = _unique_gateway("testprov").lower()
source = _unique_gateway("testroute")
created_provider = admin.post(
f"{BASE_URL}/admin/gateway/providers",
json={
"name": provider,
"base_url": "http://127.0.0.1:9/v1/chat/completions",
"api_key": "sk-test",
"is_active": True,
},
)
assert created_provider.status_code == 200, created_provider.text[:300]
created_route = admin.post(
f"{BASE_URL}/admin/gateway/models",
json={
"source_model": source,
"provider": provider,
"target_model": "vendor/dead",
"kind": "chat",
},
)
assert created_route.status_code == 200, created_route.text[:300]
try:
tested = admin.post(
f"{BASE_URL}/admin/gateway/models/{source}/test",
allow_redirects=False,
)
assert tested.status_code == 302
assert tested.headers["location"].startswith("/admin/gateway?tab=models")
listed = admin.get(f"{BASE_URL}/admin/gateway/models").json()
row = next(m for m in listed["models"] if m["source_model"] == source)
assert row["health_status"] == "bad"
assert row["health_code"] == "connection_error"
assert row["health_checked_at"]
finally:
admin.delete(f"{BASE_URL}/admin/gateway/models/{source}")
admin.delete(f"{BASE_URL}/admin/gateway/providers/{provider}")
def test_model_test_pages_require_admin_and_known_route(seeded_db):
assert (
requests.post(
f"{BASE_URL}/admin/gateway/models/x/test",
headers=JSON_gateway,
allow_redirects=False,
).status_code
== 401
)
key = member_key()
assert (
requests.post(
f"{BASE_URL}/admin/gateway/models/x/test",
headers={**JSON_gateway, "X-API-KEY": key},
allow_redirects=False,
).status_code
== 403
)
admin = admin_session(seeded_db)
missing = _unique_gateway("ghosttest")
assert admin.post(f"{BASE_URL}/admin/gateway/models/{missing}/test").status_code == 404
def test_model_route_validation(seeded_db):
admin = admin_session(seeded_db)
missing_target = admin.post(
@@ -349,3 +414,75 @@ def test_model_route_validation(seeded_db):
},
)
assert bad_kind.status_code == 400
def test_model_route_tools_mode_round_trip_and_validation(seeded_db):
admin = admin_session(seeded_db)
source = _unique_gateway("tools-mode")
default = admin.post(
f"{BASE_URL}/admin/gateway/models",
json={"source_model": source, "target_model": "vendor/t", "kind": "chat"},
)
assert default.status_code == 200, default.text[:300]
assert default.json()["model"]["tools_mode"] == "native"
emulated = admin.post(
f"{BASE_URL}/admin/gateway/models",
json={
"source_model": source,
"target_model": "vendor/t",
"kind": "chat",
"tools_mode": "emulated",
},
)
assert emulated.status_code == 200, emulated.text[:300]
assert emulated.json()["model"]["tools_mode"] == "emulated"
listed = admin.get(f"{BASE_URL}/admin/gateway/models").json()
row = next(m for m in listed["models"] if m["source_model"] == source)
assert row["tools_mode"] == "emulated"
invalid = admin.post(
f"{BASE_URL}/admin/gateway/models",
json={
"source_model": source,
"target_model": "vendor/t",
"kind": "chat",
"tools_mode": "magic",
},
)
assert invalid.json().get("ok") is not True
admin.delete(f"{BASE_URL}/admin/gateway/models/{source}")
def test_model_route_edit_page_renders_html_and_shows_tools_mode(seeded_db):
admin = admin_session(seeded_db)
source = _unique_gateway("edit-page")
created = admin.post(
f"{BASE_URL}/admin/gateway/models",
json={
"source_model": source,
"target_model": "vendor/e",
"kind": "chat",
"tools_mode": "emulated",
},
)
assert created.status_code == 200, created.text[:300]
page = admin.get(
f"{BASE_URL}/admin/gateway/models/{source}/edit",
headers={"Accept": "text/html"},
)
assert page.status_code == 200, page.text[:500]
assert 'name="tools_mode"' in page.text
assert '<option value="emulated" selected>' in page.text
index = admin.get(
f"{BASE_URL}/admin/gateway?tab=models", headers={"Accept": "text/html"}
)
assert index.status_code == 200
assert f"/admin/gateway/models/{source}/edit" in index.text
assert "tools: emulated" in index.text
admin.delete(f"{BASE_URL}/admin/gateway/models/{source}")