Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)
Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
"""Tests for workspace manager."""
|
||||
|
||||
import pytest
|
||||
|
||||
from ai_orchestrator.workspace import (
|
||||
WorkspacePathError,
|
||||
get_workspace_path,
|
||||
sanitize_workspace_key,
|
||||
)
|
||||
|
||||
|
||||
class TestSanitizeWorkspaceKey:
|
||||
"""Tests for workspace key sanitization."""
|
||||
|
||||
def test_simple_identifier(self):
|
||||
assert sanitize_workspace_key("ABC-123") == "ABC-123"
|
||||
|
||||
def test_special_characters_replaced(self):
|
||||
assert sanitize_workspace_key("ABC/123") == "ABC_123"
|
||||
assert sanitize_workspace_key("my project!") == "my_project_"
|
||||
|
||||
def test_dots_and_underscores_preserved(self):
|
||||
assert sanitize_workspace_key("v1.0_release") == "v1.0_release"
|
||||
|
||||
def test_unicode_replaced(self):
|
||||
assert sanitize_workspace_key("café-123") == "caf__123"
|
||||
|
||||
|
||||
class TestGetWorkspacePath:
|
||||
"""Tests for workspace path computation."""
|
||||
|
||||
def test_deterministic_path(self, tmp_path):
|
||||
root = str(tmp_path)
|
||||
path1 = get_workspace_path(root, "ABC-123")
|
||||
path2 = get_workspace_path(root, "ABC-123")
|
||||
assert path1 == path2
|
||||
|
||||
def test_path_inside_root(self, tmp_path):
|
||||
root = str(tmp_path)
|
||||
path = get_workspace_path(root, "ABC-123")
|
||||
assert str(path).startswith(str(tmp_path))
|
||||
|
||||
def test_path_traversal_blocked(self, tmp_path):
|
||||
# The sanitizer replaces .. with __ so this is safe
|
||||
root = str(tmp_path)
|
||||
path = get_workspace_path(root, "../escape")
|
||||
# Should be sanitized to __escape and stay inside root
|
||||
assert str(path).startswith(str(tmp_path))
|
||||
Reference in New Issue
Block a user