mirror of
https://github.com/MinaSaad1/pbi-cli
synced 2026-04-21 13:37:19 +00:00
- Add Store version path (~\Microsoft\Power BI Desktop Store App\) alongside MSI path for port auto-discovery - Fix UTF-16 LE encoding when reading msmdsrv.port.txt - Update all 5 skills to reflect new install flow (pipx + pbi connect) - Update error messages, docstrings, and READMEs to mention pbi connect as the primary entry point instead of pbi setup - Add tests for Store path discovery, encoding, and path candidates
36 lines
987 B
Python
36 lines
987 B
Python
"""Tests for pbi_cli.core.errors."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import click
|
|
|
|
from pbi_cli.core.errors import (
|
|
BinaryNotFoundError,
|
|
ConnectionRequiredError,
|
|
McpToolError,
|
|
PbiCliError,
|
|
)
|
|
|
|
|
|
def test_pbi_cli_error_is_click_exception() -> None:
|
|
err = PbiCliError("test message")
|
|
assert isinstance(err, click.ClickException)
|
|
assert err.format_message() == "test message"
|
|
|
|
|
|
def test_binary_not_found_default_message() -> None:
|
|
err = BinaryNotFoundError()
|
|
assert "pbi connect" in err.format_message()
|
|
|
|
|
|
def test_connection_required_default_message() -> None:
|
|
err = ConnectionRequiredError()
|
|
assert "pbi connect" in err.format_message()
|
|
|
|
|
|
def test_mcp_tool_error_includes_tool_name() -> None:
|
|
err = McpToolError("measure_operations", "not found")
|
|
assert "measure_operations" in err.format_message()
|
|
assert "not found" in err.format_message()
|
|
assert err.tool_name == "measure_operations"
|
|
assert err.detail == "not found"
|