generated from coulomb/repo-seed
search filters and inspection polish
This commit is contained in:
@@ -137,6 +137,43 @@ def test_search_matches_features_and_evidence_with_context(tmp_path):
|
||||
assert evidence_results[0].confidence == 0.9
|
||||
|
||||
|
||||
def test_search_filters_by_status_language_and_framework(tmp_path):
|
||||
source = tmp_path / "repo"
|
||||
source.mkdir()
|
||||
(source / "README.md").write_text("# Filterable\n", encoding="utf-8")
|
||||
(source / "requirements.txt").write_text("fastapi\n", encoding="utf-8")
|
||||
(source / "app.py").write_text(
|
||||
"from fastapi import FastAPI\n"
|
||||
"app = FastAPI()\n"
|
||||
'@app.get("/health")\n'
|
||||
"def health():\n"
|
||||
" return {}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(name="Filterable", url=str(source))
|
||||
summary = service.analyze_repository(repository.id)
|
||||
service.approve_candidate_graph(repository.id, summary.analysis_run.id)
|
||||
|
||||
results = service.search(
|
||||
"repository",
|
||||
status="indexed",
|
||||
language="Python",
|
||||
framework="FastAPI",
|
||||
)
|
||||
wrong_language_results = service.search(
|
||||
"repository",
|
||||
status="indexed",
|
||||
language="TypeScript",
|
||||
framework="FastAPI",
|
||||
)
|
||||
|
||||
assert results
|
||||
assert {result.repository_name for result in results} == {"Filterable"}
|
||||
assert wrong_language_results == []
|
||||
|
||||
|
||||
def test_register_repository_imports_metadata_when_name_is_omitted(tmp_path):
|
||||
source = tmp_path / "metadata-source"
|
||||
source.mkdir()
|
||||
|
||||
@@ -213,6 +213,13 @@ def test_api_analysis_run_loop(tmp_path):
|
||||
assert search_response.json()
|
||||
assert "matched_field" in search_response.json()[0]
|
||||
|
||||
filtered_search_response = client.get(
|
||||
"/search",
|
||||
params={"q": "frontend", "status": "indexed"},
|
||||
)
|
||||
assert filtered_search_response.status_code == 200
|
||||
assert filtered_search_response.json()
|
||||
|
||||
abilities_response = client.get("/abilities")
|
||||
assert abilities_response.status_code == 200
|
||||
assert abilities_response.json()[0]["name"] == "Frontend Delivery"
|
||||
@@ -240,6 +247,7 @@ def test_ui_register_analyze_and_approve_loop(tmp_path):
|
||||
source = tmp_path / "repo"
|
||||
source.mkdir()
|
||||
(source / "README.md").write_text("# UI Repo\n", encoding="utf-8")
|
||||
(source / "requirements.txt").write_text("fastapi\n", encoding="utf-8")
|
||||
(source / "app.py").write_text(
|
||||
"from fastapi import FastAPI\n"
|
||||
"app = FastAPI()\n"
|
||||
@@ -300,11 +308,20 @@ def test_ui_register_analyze_and_approve_loop(tmp_path):
|
||||
assert approved_detail.status_code == 200
|
||||
assert "Approved Ability Map" in approved_detail.text
|
||||
assert "Review UI Repo Repository Usefulness" in approved_detail.text
|
||||
assert "Language: Python" in approved_detail.text
|
||||
assert "Framework: FastAPI" in approved_detail.text
|
||||
|
||||
search_response = client.get("/ui/search", params={"q": "repository"})
|
||||
assert search_response.status_code == 200
|
||||
assert "UI Repo" in search_response.text
|
||||
assert "Field" in search_response.text
|
||||
|
||||
filtered_search_response = client.get(
|
||||
"/ui/search",
|
||||
params={"q": "repository", "status": "indexed", "language": "Python"},
|
||||
)
|
||||
assert filtered_search_response.status_code == 200
|
||||
assert "UI Repo" in filtered_search_response.text
|
||||
finally:
|
||||
app.dependency_overrides.clear()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user