Initial SFERA platform baseline
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from pathlib import Path
|
||||
|
||||
from semantic_kernel import index_project
|
||||
from storage_core import FileStorage
|
||||
|
||||
|
||||
def test_file_storage_saves_and_loads_snapshot(tmp_path: Path):
|
||||
source_dir = tmp_path / "src"
|
||||
source_dir.mkdir()
|
||||
(source_dir / "module.bsl").write_text("Процедура Test()\nКонецПроцедуры\n", encoding="utf-8")
|
||||
snapshot = index_project(source_dir, project_id="demo")
|
||||
storage = FileStorage(tmp_path / "storage")
|
||||
|
||||
info = storage.save_snapshot(snapshot)
|
||||
restored = storage.load_snapshot("demo")
|
||||
|
||||
assert info.project_id == "demo"
|
||||
assert restored.snapshot_hash == snapshot.snapshot_hash
|
||||
assert storage.list_snapshots()[0].snapshot_id == snapshot.snapshot_id
|
||||
|
||||
|
||||
def test_file_storage_generic_documents(tmp_path: Path):
|
||||
storage = FileStorage(tmp_path / "storage")
|
||||
|
||||
storage.write_document("knowledge", "record/1", {"record_id": "record/1", "title": "Demo"})
|
||||
|
||||
assert storage.read_document("knowledge", "record/1")["title"] == "Demo"
|
||||
assert storage.list_documents("knowledge")[0]["record_id"] == "record/1"
|
||||
Reference in New Issue
Block a user