claude-proxy / tests /cli /test_agy_session_settings.py
dheraingoud's picture
Copilot App
Sync upstream v6.19.35 and preserve custom addons
a9e27c0
Raw History Blame Contribute Delete
2.07 kB
"""FCC configures Antigravity for the child session without a saved connection."""
import json
from pathlib import Path
import pytest
from free_claude_code.harnesses import antigravity
from tests.cli.test_launcher_workflow import launch
def test_fresh_launch_uses_temporary_settings(launch_capture):
path = antigravity.config_path()
path.parent.mkdir(parents=True)
path.write_text('{"modelProvider":"", "model":"personal"}')
before = path.read_bytes()
launch_capture.versions["agy"] = "1.5.9"
files = []
def inspect(command, env):
path = Path(command[command.index("--settings") + 1])
files.append(path)
settings = json.loads(path.read_text())
assert settings["modelProvider"] == "gemini"
model = launch_capture.catalog["default_model_id"]
assert settings["customModelsConfig"]["customModels"][model]["modelName"] == (
"gemini-api://models/" + model
)
assert env["GEMINI_API_KEY"] not in path.read_text()
assert antigravity.config_path().read_bytes() == before
assert not antigravity.state_path().exists()
launch_capture.on_start = inspect
launch("agy", ["--print", "hello"])
assert files and all(not path.exists() for path in files)
@pytest.mark.parametrize(
"args",
[
["--settings", "{}"],
["--settings={}"],
["-settings", "{}"],
["-settings={}"],
["--settings", "my session settings.json"],
["--settings", "{}", "--settings", "another.json"],
["--model", "print", "--settings", "{}"],
["--log-file", "--print", "--settings", "{}", "--print", "hello"],
["--print", "--settings"],
["--print=--settings"],
],
)
def test_user_arguments_follow_fcc_defaults_without_interpretation(
args, launch_capture
):
launch("agy", args)
command = launch_capture.commands[0]
assert command[:2] == ["agy", "--settings"]
assert command[3:5] == ["--model", launch_capture.catalog["default_model_id"]]
assert command[5:] == args