Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

889 B
Raw Blame
"""Tests for POST /api/v1/osquery/config."""

from __future__ import annotations

import pytest


async def _enroll(client, host: str = "cfg-host") -> str:
    r = await client.post(
        "/api/v1/osquery/enroll",
        json={"enroll_secret": "test-enroll-secret", "host_identifier": host},
    )
    return r.json()["node_key"]


@pytest.mark.asyncio
async def test_config_valid_node(client):
    node_key = await _enroll(client, "cfg-host-1")
    resp = await client.post(
        "/api/v1/osquery/config",
        json={"node_key": node_key},
    )
    assert resp.status_code == 200
    data = resp.json()
    assert "schedule" in data
    assert "options" in data


@pytest.mark.asyncio
async def test_config_invalid_node(client):
    resp = await client.post(
        "/api/v1/osquery/config",
        json={"node_key": "totally-fake"},
    )
    assert resp.status_code == 401