feat(F-551): PFAD:-Präfix gegen Slash-Command-Blockade @implements: [F-551]
onboarding.py: PFAD_PREFIX + extract_path_with_prefix (streift PFAD:-Präfix, rückwärtskompatibel); adapter.py: ::setfakt path + _handle_fakt_store_path_input streifen Präfix ab vor Validierung, PFAD:-Beispiel in Aufforderungstexten/Dialog/Beschreibung; Tests: TestExtractPathWithPrefix (6); Analysen/F551_Architektur_dot45.md
This commit is contained in:
@@ -3,7 +3,7 @@ Tests für FAKT-Speicherort-Dialog beim Onboarding (Thema 3).
|
||||
|
||||
Prüft:
|
||||
- room_map.py: fact_store_strategy, fact_store_created_at Felder + Migration
|
||||
- onboarding.py: Pfad-Validierung, 4-Optionen-Dialog
|
||||
- onboarding.py: Pfad-Validierung + F-551 PFAD:-Präfix-Extraktion
|
||||
- doc_store.py: set_base_dir()
|
||||
- adapter_integration.py: strategy-aware Instanziierung
|
||||
"""
|
||||
@@ -284,6 +284,59 @@ class TestFactStorePathValidation:
|
||||
assert result["valid"] is True
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# F-551: PFAD:-Präfix-Extraktion (Slash-Command-Blockade umgehen)
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
class TestExtractPathWithPrefix:
|
||||
"""F-551: extract_path_with_prefix — PFAD:-Präfix wird vor Validierung abgestreift."""
|
||||
|
||||
def test_plain_path_no_prefix(self):
|
||||
"""Eingabe ohne Präfix bleibt unverändert (Rückwärtskompatibel)."""
|
||||
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||
result = extract_path_with_prefix("/data/Wissensdatenbank")
|
||||
assert result["had_prefix"] is False
|
||||
assert result["path"] == "/data/Wissensdatenbank"
|
||||
|
||||
def test_prefix_stripped(self):
|
||||
"""'PFAD: /data/Wissensdatenbank' → Pfad ohne Präfix."""
|
||||
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||
result = extract_path_with_prefix("PFAD: /data/Wissensdatenbank")
|
||||
assert result["had_prefix"] is True
|
||||
assert result["path"] == "/data/Wissensdatenbank"
|
||||
|
||||
def test_prefix_no_space_after_colon(self):
|
||||
"""'PFAD:/data/Wissensdatenbank' (ohne Leerzeichen) wird toleriert."""
|
||||
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||
result = extract_path_with_prefix("PFAD:/data/Wissensdatenbank")
|
||||
assert result["had_prefix"] is True
|
||||
assert result["path"] == "/data/Wissensdatenbank"
|
||||
|
||||
def test_prefix_lowercase_insensitive(self):
|
||||
"""'pfad: /data/...' wird case-insensitiv erkannt."""
|
||||
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||
result = extract_path_with_prefix("pfad: /data/Wissensdatenbank")
|
||||
assert result["had_prefix"] is True
|
||||
assert result["path"] == "/data/Wissensdatenbank"
|
||||
|
||||
def test_prefix_then_validate_ok(self):
|
||||
"""Präfix-Eingabe liefert einen Pfad, den validate_fact_store_path akzeptiert."""
|
||||
from plugin.archivar.onboarding import (
|
||||
extract_path_with_prefix,
|
||||
validate_fact_store_path,
|
||||
)
|
||||
extracted = extract_path_with_prefix("PFAD: /tmp/fakt_test")
|
||||
validation = validate_fact_store_path(extracted["path"])
|
||||
assert validation["valid"] is True
|
||||
|
||||
def test_empty_input(self):
|
||||
"""Leere Eingabe liefert had_prefix=False und path unverändert."""
|
||||
from plugin.archivar.onboarding import extract_path_with_prefix
|
||||
result = extract_path_with_prefix("")
|
||||
assert result["had_prefix"] is False
|
||||
assert result["path"] == ""
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# doc_store.py: set_base_dir()
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user