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

@ -106,13 +106,23 @@ async def test_rdp_credentials_delete(client):
hg_id, host_id = await _setup_hostgroup_and_host(conn, group_name="rd-group", hostname="rd-host", protocol="rdp")
await _login_full(client, "rd_admin", "Correct-Horse-Battery-Staple-R1")
resp = await client.put(f"/admin/hosts/{host_id}/rdp-credentials",
json={"username": "Administrator", "password": "s3hr-geheim!!"})
# Migration 0012: das Zugangsdaten-Objekt wird eigenstaendig angelegt und
# dann dem Host zugewiesen (POST .../rdp-credentials/{credential_id}),
# statt direkt am Host mit Passwort erzeugt zu werden.
resp = await client.post(
"/admin/rdp-credentials",
json={"label": "rd-cred", "username": "Administrator", "password": "s3hr-geheim!!", "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}/credentials")
assert resp.json()["rdp_credentials_set"] is True
# Loeschen HIER entfernt nur die Zuordnung zum Host -- das Objekt selbst
# bleibt bestehen (siehe unassign_rdp_credential_from_host).
resp = await client.delete(f"/admin/hosts/{host_id}/rdp-credentials")
assert resp.status_code == 200, resp.text