Skip to content

Commit fa920cf

Browse files
Hackshavenclaude
andcommitted
test(search): cover flag_overrides and align regression test with schema
- Add test_search_api_query_flag_override: asserts api_query key emits --query (not --api-query) via the flag_overrides mapping. - Add test_search_api_natural_query_key: asserts the client-friendly "query" key also produces --query naturally. - Update regression test to use api_query (matching the published schema name from dest) instead of the natural query key. Signed-off-by: Eric Hackathorn <erichackathorn@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent cdc3cb1 commit fa920cf

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

tests/api/test_cli_run_search_stage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_cli_run_accepts_search_stage():
2424
json={
2525
"stage": "search",
2626
"command": "api",
27-
"args": {"url": "https://example.com/api", "query": "temperature"},
27+
"args": {"url": "https://example.com/api", "api_query": "temperature"},
2828
},
2929
)
3030
assert r.status_code == 200, f"unexpected status: {r.json()}"

tests/cli/test_api_args.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,30 @@ def test_aliases_dest_target_and_src():
5656
assert argv[:2] == ["decimate", "local"]
5757
# path should be positional at the end
5858
assert argv[-1] == "./out.bin"
59+
60+
61+
def test_search_api_query_flag_override():
62+
"""api_query key must emit --query (not --api-query)."""
63+
argv = _args_dict_to_argv(
64+
"search",
65+
"api",
66+
{"url": "https://example.com/api", "api_query": "temperature"},
67+
)
68+
assert argv[:2] == ["search", "api"]
69+
assert "--query" in argv
70+
assert "--api-query" not in argv
71+
i = argv.index("--query")
72+
assert argv[i + 1] == "temperature"
73+
74+
75+
def test_search_api_natural_query_key():
76+
"""Client-friendly 'query' key must also produce --query."""
77+
argv = _args_dict_to_argv(
78+
"search",
79+
"api",
80+
{"url": "https://example.com/api", "query": "temperature"},
81+
)
82+
assert argv[:2] == ["search", "api"]
83+
assert "--query" in argv
84+
i = argv.index("--query")
85+
assert argv[i + 1] == "temperature"

0 commit comments

Comments
 (0)