feat: host display_name в ingest, поиск хостов, UI и docs
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -70,6 +70,36 @@ def test_ingest_rdp_lifecycle_201(client, auth_headers):
|
||||
assert r.json()["event_id"] == event_id
|
||||
|
||||
|
||||
def test_ingest_host_display_name_updated(client, auth_headers, db_session):
|
||||
from sqlalchemy import select
|
||||
|
||||
from app.models import Host
|
||||
|
||||
event_id = str(uuid.uuid4())
|
||||
payload = {
|
||||
**VALID_EVENT,
|
||||
"event_id": event_id,
|
||||
"host": {
|
||||
"hostname": "short-name",
|
||||
"display_name": "UNMS Kalina",
|
||||
"os_family": "linux",
|
||||
},
|
||||
}
|
||||
assert client.post("/api/v1/events", json=payload, headers=auth_headers).status_code == 201
|
||||
host = db_session.scalar(select(Host).where(Host.hostname == "short-name"))
|
||||
assert host is not None
|
||||
assert host.display_name == "UNMS Kalina"
|
||||
|
||||
payload2 = {
|
||||
**payload,
|
||||
"event_id": str(uuid.uuid4()),
|
||||
"host": {"hostname": "short-name", "display_name": "Kalina UNMS", "os_family": "linux"},
|
||||
}
|
||||
assert client.post("/api/v1/events", json=payload2, headers=auth_headers).status_code == 201
|
||||
db_session.refresh(host)
|
||||
assert host.display_name == "Kalina UNMS"
|
||||
|
||||
|
||||
def test_ingest_invalid_payload_422(client, auth_headers):
|
||||
r = client.post(
|
||||
"/api/v1/events",
|
||||
|
||||
Reference in New Issue
Block a user