Files
DECNET/tests/api/ttp/conftest.py
anti f2b3393669 chore: relicense to AGPL-3.0-or-later and add SPDX headers
Replaces LICENSE (GPLv3 -> AGPLv3) and prepends
`SPDX-License-Identifier: AGPL-3.0-or-later` to every source file
across decnet/, decnet_web/, tests/, scripts/, and tools/.

Rationale: closes the GPLv3 ASP loophole so any party operating a
modified DECNET as a network service must offer their modified
source. Personal copyright (Samuel Paschuan) + inbound=outbound
contributions make a future unilateral relicense infeasible.

- LICENSE: full AGPL-3.0 text (gnu.org/licenses/agpl-3.0.txt)
- COPYRIGHT: project copyright notice
- tools/add_spdx_headers.py: idempotent header injector
  (shebang- and PEP 263-aware)

Touches 1565 source files (.py, .ts, .tsx, .js, .jsx, .css, .sh).
No behavior change; comments only.
2026-05-22 21:04:16 -04:00

35 lines
1.3 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""Shared helpers for TTP API contract tests (E.2.8).
The base ``tests/api/conftest.py`` already provides ``client``,
``auth_token`` (admin role) and ``viewer_token`` (viewer role). This
module adds TTP-specific path constants + a small ``_hdr`` helper so
each test file stays focused on the one endpoint it covers.
"""
from __future__ import annotations
_BASE = "/api/v1/ttp"
def hdr(token: str) -> dict[str, str]:
return {"Authorization": f"Bearer {token}"}
# ─── Endpoint paths ──────────────────────────────────────────────────────────
# Read endpoints — every entry must round-trip 401 without a JWT and
# 200 with one. Documented in TTP_TAGGING.md "API surface".
TECHNIQUES = f"{_BASE}/techniques"
BY_IDENTITY = _BASE + "/by-identity/{identity_uuid}"
BY_ATTACKER = _BASE + "/by-attacker/{attacker_uuid}"
BY_CAMPAIGN = _BASE + "/by-campaign/{campaign_uuid}"
BY_SESSION = _BASE + "/by-session/{session_id}"
RULES = f"{_BASE}/rules"
TAG_DETAILS = _BASE + "/tags/by-{scope}/{uuid}/{technique_id}"
NAVIGATOR = f"{_BASE}/export/navigator"
NAVIGATOR_IDENTITY = _BASE + "/export/navigator/identity/{uuid}"
# Mutation endpoints — admin-only.
RULE_STATE = _BASE + "/rules/{rule_id}/state"