connectiopn fix round 2 1

This commit is contained in:
2026-08-21 14:18:27 +02:00
parent ad728ba96c
commit 6b2c5ac8a2
11 changed files with 544 additions and 135 deletions

View File

@ -605,10 +605,16 @@ async def test_host_detail_endpoint_includes_ssh_keys_and_rdp_flag(client):
resp = await client.post(f"/admin/hosts/{host_id}/ssh-keys/{key_id}")
assert resp.status_code == 200, resp.text
resp = await client.put(
f"/admin/hosts/{host_id}/rdp-credentials",
json={"password": "Correct-Horse-Battery-Staple-O2", "username": "Administrator"},
# Migration 0012: RDP-Zugangsdaten sind ein eigenstaendiges Objekt, das
# separat angelegt und dann dem Host zugewiesen wird (wie ein SSH-Key).
resp = await client.post(
"/admin/rdp-credentials",
json={"label": "detail-cred", "username": "Administrator",
"password": "Correct-Horse-Battery-Staple-O2", "tenant_id": 1},
)
assert resp.status_code == 201, resp.text
credential_id = resp.json()["id"]
resp = await client.post(f"/admin/hosts/{host_id}/rdp-credentials/{credential_id}", json={})
assert resp.status_code == 200, resp.text
resp = await client.get(f"/admin/hosts/{host_id}")
@ -617,11 +623,12 @@ async def test_host_detail_endpoint_includes_ssh_keys_and_rdp_flag(client):
assert data["hostname"] == "win-srv"
assert any(k["id"] == key_id for k in data["ssh_keys"])
assert data["rdp_credentials_set"] is True
assert data["rdp_credentials_id"] == credential_id
resp = await client.get("/admin/rdp-credentials")
assert resp.status_code == 200, resp.text
row = next(r for r in resp.json() if r["host_id"] == host_id)
assert row["credentials_set"] is True
row = next(r for r in resp.json() if r["id"] == credential_id)
assert any(h["id"] == host_id for h in row["assigned_hosts"])
resp = await client.get("/admin/hosts/424242")
assert resp.status_code == 404