feat(mcp): tool search_organisations (résolution nom -> id)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import pytest
|
||||
|
||||
import src.utils.search as search_mod
|
||||
from src.mcp.queries import search_organisations
|
||||
from src.utils.data import DF_ACHETEURS
|
||||
from src.utils.search import search_org
|
||||
|
||||
@@ -19,3 +22,20 @@ def test_search_org_track_true_calls_track_search(monkeypatch):
|
||||
search_org(DF_ACHETEURS, "ACHETEUR", "acheteur", track=True)
|
||||
|
||||
assert calls == [("ACHETEUR", "home_page_search")]
|
||||
|
||||
|
||||
def test_search_organisations_finds_known_acheteur():
|
||||
result = search_organisations("ACHETEUR", "acheteur")
|
||||
assert any(r["id"] == "123" for r in result)
|
||||
first = next(r for r in result if r["id"] == "123")
|
||||
assert set(first.keys()) == {"id", "nom", "departement"}
|
||||
|
||||
|
||||
def test_search_organisations_invalid_type_raises():
|
||||
with pytest.raises(ValueError):
|
||||
search_organisations("x", "autre")
|
||||
|
||||
|
||||
def test_search_organisations_respects_limite():
|
||||
result = search_organisations("ACHETEUR", "acheteur", limite=1)
|
||||
assert len(result) <= 1
|
||||
|
||||
Reference in New Issue
Block a user