Files
breakpilot-compliance/consent-tester/tests/test_consent_history.py
T
Benjamin Admin d92dd3b5fc feat(banner): Consent-Historie/Widerruf live erkennen (Borlabs-Stil, #62)
consent_history.detect_consent_history: erkennt CMP-Anbieter (Borlabs/
Usercentrics/OneTrust/Cookiebot/…) aus Storage+Cookies, versionierten Consent
(historie-fähig) + dauerhaftes Widerruf-/Einstellungs-Widget. consent_scanner
ruft es in Phase A; scan_matrix_summary surft summary.consent_history;
browser_cross_finding: positiver Befund wenn vorhanden, sonst Best-Practice-LOW
(„Nutzer sehen, wann sie welcher Version zugestimmt haben"); BrowserBehaviorView
zeigt es im Engine-Detail. Tests: 7 (classify/versioned) + 2 Cross-Finding.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-13 16:38:38 +02:00

36 lines
1.0 KiB
Python

"""Consent-Historie-Erkennung (#62) — pure Klassifikation."""
from services.consent_history import classify_provider, _is_versioned
def test_classify_borlabs():
assert classify_provider(["borlabs-cookie", "PHPSESSID"]) == "Borlabs"
def test_classify_onetrust():
assert classify_provider(["OptanonConsent", "foo"]) == "OneTrust"
def test_classify_cookiebot():
assert classify_provider(["CookieConsent"]) == "Cookiebot"
def test_classify_unknown_empty():
assert classify_provider(["sessionid", "csrftoken"]) == ""
assert classify_provider([]) == ""
def test_versioned_from_stored_value():
assert _is_versioned("Borlabs", '{"version":3,"consents":{}}') is True
assert _is_versioned("Borlabs", '{"timestamp":123}') is True
def test_versioned_capability_without_value():
# Borlabs ist historie-fähig auch ohne ausgelesenen Wert.
assert _is_versioned("Borlabs", None) is True
def test_not_versioned_unknown_provider():
assert _is_versioned("", None) is False
assert _is_versioned("", "irgendwas") is False