Skip to content

Commit daa1fb1

Browse files
committed
testcode
1 parent bdb7fef commit daa1fb1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/cli/test_console.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ def test_missing_uri(mocker: MockFixture, empty_home_dir_path: str) -> None:
4848
assert result.output == "Could not initialize catalog with the following properties: {}\n"
4949

5050

51+
def test_hive_catalog_missing_uri_shows_helpful_error(mocker: MockFixture) -> None:
52+
mock_env_config = mocker.MagicMock()
53+
mock_env_config.get_catalog_config.return_value = {"type": "hive"}
54+
mocker.patch("pyiceberg.catalog._ENV_CONFIG", mock_env_config)
55+
56+
runner = CliRunner()
57+
result = runner.invoke(run, ["--catalog", "my_hive_catalog", "list"])
58+
59+
assert result.exit_code == 1
60+
assert "URI missing, please provide using --uri" in result.output
61+
assert "'uri'" not in result.output
62+
63+
5164
@pytest.fixture(autouse=True)
5265
def env_vars(mocker: MockFixture) -> None:
5366
mocker.patch.dict(os.environ, MOCK_ENVIRONMENT)

0 commit comments

Comments
 (0)