def test_cli_remove_int(tljh_dir): config.main(["add-item", "foo.bar", "1"]) config.main(["add-item", "foo.bar", "2"]) cfg = configurer.load_config() assert cfg['foo']['bar'] == [1, 2] config.main(["remove-item", "foo.bar", "1"]) cfg = configurer.load_config() assert cfg['foo']['bar'] == [2]
def test_cli_unset(tljh_dir): config.main(["set", "foo.bar", "1"]) config.main(["set", "foo.bar2", "2"]) cfg = configurer.load_config() assert cfg['foo'] == {'bar': 1, 'bar2': 2} config.main(["unset", "foo.bar"]) cfg = configurer.load_config() assert cfg['foo'] == {'bar2': 2}
def test_cli_unset(tljh_dir): config.main(["set", "foo.bar", "1"]) config.main(["set", "foo.bar2", "2"]) cfg = configurer.load_config() assert cfg["foo"] == {"bar": 1, "bar2": 2} config.main(["unset", "foo.bar"]) cfg = configurer.load_config() assert cfg["foo"] == {"bar2": 2}
def test_cli_add_float(tljh_dir): config.main(["add-item", "foo.bar", "1.25"]) cfg = configurer.load_config() assert cfg['foo']['bar'] == [1.25]
def test_cli_set_int(tljh_dir): config.main(["set", "https.port", "123"]) cfg = configurer.load_config() assert cfg['https']['port'] == 123
def test_cli_set_bool(tljh_dir, arg, value): config.main(["set", "https.enabled", arg]) cfg = configurer.load_config() assert cfg['https']['enabled'] == value
def test_cli_no_command(capsys): config.main([]) captured = capsys.readouterr() assert "usage:" in captured.out assert "positional arguments:" in captured.out