35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
from pathlib import Path
|
|
|
|
from zotero_kb.config import AppConfig
|
|
from zotero_kb.workspace import Workspace
|
|
|
|
|
|
def test_workspace_initialization_creates_required_directories(tmp_path: Path) -> None:
|
|
config = AppConfig(workspace_dir=tmp_path / "workspace", zotero_data_dir=tmp_path / "zotero")
|
|
workspace = Workspace(config)
|
|
|
|
workspace.ensure_layout()
|
|
|
|
assert (config.workspace_dir / "library" / "collections").is_dir()
|
|
assert (config.workspace_dir / "library" / "index").is_dir()
|
|
assert (config.workspace_dir / "library" / "cache" / "source-bundles").is_dir()
|
|
assert (config.workspace_dir / "projects").is_dir()
|
|
|
|
|
|
def test_create_project_writes_project_files(tmp_path: Path) -> None:
|
|
config = AppConfig(workspace_dir=tmp_path / "workspace", zotero_data_dir=tmp_path / "zotero")
|
|
workspace = Workspace(config)
|
|
workspace.ensure_layout()
|
|
|
|
project = workspace.create_project(
|
|
project_id="thesis-ch2",
|
|
name="Thesis Chapter 2",
|
|
llm_provider="openai",
|
|
llm_model="gpt-5-mini",
|
|
)
|
|
|
|
assert project.project_id == "thesis-ch2"
|
|
assert (config.workspace_dir / "projects" / "thesis-ch2" / "project.json").is_file()
|
|
assert (config.workspace_dir / "projects" / "thesis-ch2" / "selected-items.json").is_file()
|
|
assert (config.workspace_dir / "projects" / "thesis-ch2" / "project-index.json").is_file()
|