tests/test_graph_unit.py hinzugefügt
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
This commit is contained in:
parent
6a84b4e5aa
commit
02a61cdf0d
20
tests/test_graph_unit.py
Normal file
20
tests/test_graph_unit.py
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
from fastapi.testclient import TestClient
|
||||||
|
from app.main import create_app
|
||||||
|
import app.core.graph_adapter as ga
|
||||||
|
|
||||||
|
def _fake_get_edges_for_sources(client, prefix, source_ids, edge_types=None, limit=2048):
|
||||||
|
note_id = source_ids[0]
|
||||||
|
return [
|
||||||
|
{"source_id":note_id,"target_id":f"{note_id}#c1","kind":"references","weight":0.2},
|
||||||
|
{"source_id":note_id,"target_id":f"{note_id}#c2","kind":"belongs_to","weight":0.1},
|
||||||
|
]
|
||||||
|
|
||||||
|
def test_graph_neighbors(monkeypatch):
|
||||||
|
monkeypatch.setattr(ga, "get_edges_for_sources", _fake_get_edges_for_sources, raising=False)
|
||||||
|
app = create_app()
|
||||||
|
with TestClient(app) as c:
|
||||||
|
r = c.get("/graph/TEST-NOTE?depth=1")
|
||||||
|
assert r.status_code == 200
|
||||||
|
g = r.json()
|
||||||
|
assert g["center_note_id"] == "TEST-NOTE"
|
||||||
|
assert g["stats"]["edge_count"] == 2
|
||||||
Loading…
Reference in New Issue
Block a user