generated from coulomb/repo-seed
Explore after registration as default
This commit is contained in:
@@ -1075,6 +1075,7 @@ def test_ui_register_analyze_and_approve_loop(tmp_path):
|
||||
assert "Register Repository" in index_response.text
|
||||
assert "Registering repository..." in index_response.text
|
||||
assert "Password or access token" in index_response.text
|
||||
assert "Explore after registration" in index_response.text
|
||||
|
||||
create_response = client.post(
|
||||
"/ui/repos",
|
||||
@@ -1083,6 +1084,7 @@ def test_ui_register_analyze_and_approve_loop(tmp_path):
|
||||
"branch": "main",
|
||||
"access_username": "",
|
||||
"access_password": "",
|
||||
"explore_after_registration": "",
|
||||
},
|
||||
follow_redirects=False,
|
||||
)
|
||||
@@ -1210,6 +1212,47 @@ def test_ui_register_analyze_and_approve_loop(tmp_path):
|
||||
app.dependency_overrides.clear()
|
||||
|
||||
|
||||
def test_ui_register_and_explore_lands_on_analysis_result(tmp_path):
|
||||
source = tmp_path / "explore-repo"
|
||||
source.mkdir()
|
||||
(source / "README.md").write_text("# Explore Repo\n", encoding="utf-8")
|
||||
(source / "pyproject.toml").write_text(
|
||||
"[project]\nname = \"explore-repo\"\ndescription = \"Explorable repo.\"\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
def override_settings():
|
||||
return Settings(
|
||||
database_path=str(tmp_path / "ui-explore.sqlite3"),
|
||||
checkout_root=str(tmp_path / "ui-explore-checkouts"),
|
||||
)
|
||||
|
||||
app.dependency_overrides[get_settings] = override_settings
|
||||
client = TestClient(app)
|
||||
try:
|
||||
response = client.post(
|
||||
"/ui/repos",
|
||||
data={
|
||||
"url": str(source),
|
||||
"branch": "main",
|
||||
"access_username": "",
|
||||
"access_password": "",
|
||||
"explore_after_registration": "1",
|
||||
},
|
||||
follow_redirects=False,
|
||||
)
|
||||
|
||||
assert response.status_code == 303
|
||||
assert response.headers["location"].endswith("/analysis-runs/1")
|
||||
|
||||
result = client.get(response.headers["location"])
|
||||
assert result.status_code == 200
|
||||
assert "Candidate Graph" in result.text
|
||||
assert "Observed Facts" in result.text
|
||||
finally:
|
||||
app.dependency_overrides.clear()
|
||||
|
||||
|
||||
def test_ui_registration_failure_returns_feedback(tmp_path):
|
||||
def override_settings():
|
||||
return Settings(
|
||||
|
||||
Reference in New Issue
Block a user