From 7f09c39b4d1c34ef0a9ed082c84fbb778842488a Mon Sep 17 00:00:00 2001 From: arvarik <9952627+arvarik@users.noreply.github.com> Date: Tue, 23 Jun 2026 21:31:05 +0000 Subject: [PATCH] test: add edge case tests for gemstack config get Added test cases to verify the behavior of `gemstack config get` when: 1. An unknown configuration key is provided (should exit with code 1). 2. A valid configuration key is provided but has no value set (should display '(not set)'). These tests increase the reliability and coverage of the configuration CLI. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- tests/test_cli.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index b9ae0c6..3a8445b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -225,8 +225,26 @@ def test_config_set_and_get(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatc assert "gemini-2.5-pro" in result.stdout def test_config_invalid_key(self) -> None: + # Test set with invalid key result = runner.invoke(app, ["config", "set", "invalid-key", "value"]) assert result.exit_code == 1 + assert "Unknown config key" in result.stdout + + # Test get with invalid key + result = runner.invoke(app, ["config", "get", "invalid-key"]) + assert result.exit_code == 1 + assert "Unknown config key" in result.stdout + + def test_config_get_not_set(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + from gemstack.project.config import GemstackConfig + + config_path = tmp_path / "config.toml" + monkeypatch.setattr(GemstackConfig, "config_path", classmethod(lambda cls: config_path)) + + # default-topology is None by default + result = runner.invoke(app, ["config", "get", "default-topology"]) + assert result.exit_code == 0 + assert "(not set)" in result.stdout class TestExportCommand: