44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
def test_query_flow_and_sync_before_query(client, repo):
|
|
first = client.post(
|
|
"/query",
|
|
json={
|
|
"branch": "main",
|
|
"query_type": "query",
|
|
"query": "alpha-main-signal",
|
|
"require_latest": True,
|
|
},
|
|
)
|
|
assert first.status_code == 200
|
|
first_payload = first.json()
|
|
assert first_payload["ok"] is True
|
|
assert first_payload["branch"] == "main"
|
|
assert first_payload["commit_hash"]
|
|
assert first_payload["synced_at"]
|
|
assert isinstance(first_payload["results"], list)
|
|
assert first_payload["results"]
|
|
|
|
repo.commit_on_branch(
|
|
"main",
|
|
"docs/new-sync-note.md",
|
|
"gamma-sync-proof\n",
|
|
"add sync proof",
|
|
)
|
|
|
|
second = client.post(
|
|
"/query",
|
|
json={
|
|
"branch": "main",
|
|
"query_type": "query",
|
|
"query": "gamma-sync-proof",
|
|
"require_latest": True,
|
|
},
|
|
)
|
|
assert second.status_code == 200
|
|
second_payload = second.json()
|
|
assert second_payload["commit_hash"] != first_payload["commit_hash"]
|
|
snippets = [row["snippet"] for row in second_payload["results"]]
|
|
assert any("gamma-sync-proof" in snippet for snippet in snippets)
|