52 lines
1.9 KiB
Python
52 lines
1.9 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
def test_branch_isolation(client):
|
|
main_resp = client.post(
|
|
"/query",
|
|
json={"branch": "main", "query_type": "search", "query": "main-exclusive-signal", "require_latest": True},
|
|
)
|
|
assert main_resp.status_code == 200
|
|
main_payload = main_resp.json()
|
|
assert main_payload["branch"] == "main"
|
|
assert main_payload["results"]
|
|
|
|
monthly_resp = client.post(
|
|
"/query",
|
|
json={"branch": "memory/2026-03", "query_type": "search", "query": "monthly-exclusive-signal", "require_latest": True},
|
|
)
|
|
assert monthly_resp.status_code == 200
|
|
monthly_payload = monthly_resp.json()
|
|
assert monthly_payload["branch"] == "memory/2026-03"
|
|
assert monthly_payload["results"]
|
|
|
|
cross_main = client.post(
|
|
"/query",
|
|
json={"branch": "main", "query_type": "search", "query": "monthly-exclusive-signal", "require_latest": True},
|
|
)
|
|
assert cross_main.status_code == 200
|
|
assert cross_main.json()["results"] == []
|
|
|
|
cross_monthly = client.post(
|
|
"/query",
|
|
json={"branch": "memory/2026-03", "query_type": "search", "query": "main-exclusive-signal", "require_latest": True},
|
|
)
|
|
assert cross_monthly.status_code == 200
|
|
assert cross_monthly.json()["results"] == []
|
|
|
|
|
|
def test_memory_profile_and_default_branch(client):
|
|
profile_resp = client.post(
|
|
"/query",
|
|
json={"memory_profile": "monthly-2026-03", "query_type": "search", "query": "monthly-exclusive-signal", "require_latest": True},
|
|
)
|
|
assert profile_resp.status_code == 200
|
|
assert profile_resp.json()["branch"] == "memory/2026-03"
|
|
|
|
default_resp = client.post(
|
|
"/query",
|
|
json={"query_type": "search", "query": "main-exclusive-signal", "require_latest": True},
|
|
)
|
|
assert default_resp.status_code == 200
|
|
assert default_resp.json()["branch"] == "main"
|