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>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user